2
0

_field-comment-control.scss 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // Comments
  2. $icon-size: theme('spacing.4');
  3. $button-padding: theme('spacing.2');
  4. .w-field__comment-button {
  5. $root: &;
  6. @include transition(opacity 0.2s ease);
  7. position: absolute;
  8. color: theme('colors.text-button-outline-default');
  9. background: none;
  10. border: 0;
  11. padding: theme('spacing.4') $button-padding;
  12. inset-inline-end: calc(-1 * ($icon-size + $button-padding * 2));
  13. top: 50%;
  14. transform: translateY(-50%);
  15. // Only show the buttons when commenting is enabled.
  16. display: none;
  17. opacity: 0;
  18. .icon {
  19. width: $icon-size;
  20. height: $icon-size;
  21. color: inherit;
  22. }
  23. .tab-content--comments-enabled & {
  24. display: block;
  25. }
  26. // For devices without hover support, always show when comments are enabled.
  27. @media (hover: none) {
  28. .tab-content--comments-enabled & {
  29. opacity: 1;
  30. }
  31. }
  32. // Hide by default, reveal on hover of parent, for devices supporting hover interaction
  33. @media (hover: hover) {
  34. .w-field__input:hover > &,
  35. .w-field__input:focus-within > &,
  36. &:hover,
  37. &:focus,
  38. &.w-field__comment-button--focused {
  39. opacity: 1;
  40. }
  41. }
  42. // Special positioning of comment icons to sit at the top right of these fields
  43. textarea ~ &,
  44. .w-field--checkbox_select_multiple &,
  45. .w-field--admin_tag_widget & {
  46. transform: translateY(0);
  47. top: 0;
  48. }
  49. .w-field--date_field &,
  50. .w-field--date_time_field &,
  51. .w-field--time_field & {
  52. position: relative;
  53. transform: translateY(0);
  54. top: 0;
  55. }
  56. }
  57. .w-field__comment-button--add {
  58. .icon-comment-add,
  59. .icon-comment-add-reversed {
  60. display: none;
  61. }
  62. &:not(:hover) {
  63. .icon-comment-add-reversed {
  64. display: block;
  65. }
  66. }
  67. &:hover {
  68. cursor: pointer;
  69. .icon-comment-add {
  70. display: block;
  71. }
  72. }
  73. // Hide the "Add comment" button if it’s preceded by a "Reveal comment" button.
  74. .w-field__comment-button--reveal + & {
  75. display: none;
  76. }
  77. }
  78. .w-field__comment-button--reveal {
  79. display: none;
  80. .tab-content--comments-enabled & {
  81. display: block;
  82. }
  83. }