_field-comment-control.scss 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. }
  50. .w-field__comment-button--add {
  51. .icon-comment-add,
  52. .icon-comment-add-reversed {
  53. display: none;
  54. }
  55. &:not(:hover) {
  56. .icon-comment-add-reversed {
  57. display: block;
  58. }
  59. }
  60. &:hover {
  61. cursor: pointer;
  62. .icon-comment-add {
  63. display: block;
  64. }
  65. }
  66. // Hide the "Add comment" button if it’s preceded by a "Reveal comment" button.
  67. .w-field__comment-button--reveal + & {
  68. display: none;
  69. }
  70. }
  71. .w-field__comment-button--reveal {
  72. display: none;
  73. .tab-content--comments-enabled & {
  74. display: block;
  75. }
  76. }