MenuItem.scss 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // stylelint-disable declaration-no-important
  2. .sidebar-menu-item {
  3. $root: &;
  4. @include transition(border-color $menu-transition-duration ease);
  5. position: relative;
  6. &__link {
  7. @apply w-text-14;
  8. @include transition(
  9. border-color $menu-transition-duration ease,
  10. background-color $menu-transition-duration ease
  11. );
  12. position: relative;
  13. display: block;
  14. width: 100%;
  15. box-sizing: border-box;
  16. white-space: nowrap;
  17. border-inline-start: 3px solid transparent;
  18. -webkit-font-smoothing: auto;
  19. border: 0;
  20. background: transparent;
  21. text-align: start;
  22. color: $color-menu-text;
  23. padding: 11px 20px;
  24. font-weight: 400;
  25. // Note, font-weights lower than normal,
  26. // and font-size smaller than 1em (80% ~= 12.8px),
  27. // makes the strokes thinner than 1px on non-retina screens
  28. // making the text semi-transparent
  29. &:hover,
  30. &:focus {
  31. color: $color-white;
  32. text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.3);
  33. }
  34. &:before {
  35. font-size: 1rem;
  36. vertical-align: -15%;
  37. margin-inline-end: 0.5em;
  38. }
  39. // only really used for spinners and settings menu
  40. &:after {
  41. font-size: 1.5em;
  42. margin: 0;
  43. position: absolute;
  44. // Remove once we drop support for Safari 13.
  45. // stylelint-disable-next-line property-disallowed-list
  46. right: 0.5em;
  47. inset-inline-end: 0.5em;
  48. top: 0.5em;
  49. margin-top: 0;
  50. }
  51. // Disable icon margin, this is instead applied to the left of the .menuitem-label
  52. // This is because SVG icons and legacy icons apply this margin differently,
  53. // we could remove this override when we remove legacy icons
  54. .icon {
  55. margin-inline-end: 0 !important;
  56. }
  57. }
  58. &--in-sub-menu {
  59. @apply hover:w-bg-primary;
  60. #{$root}__link {
  61. // Links inside a submenu should have normal wrapping
  62. white-space: normal;
  63. }
  64. }
  65. &--active {
  66. @apply w-bg-primary-200;
  67. text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.3);
  68. > a {
  69. border-inline-start-color: $color-salmon;
  70. color: $color-white;
  71. }
  72. }
  73. }
  74. .menuitem-label {
  75. @include transition(opacity $menu-transition-duration ease);
  76. margin-inline-start: 0.5em;
  77. }
  78. .sidebar--slim {
  79. .sidebar-menu-item {
  80. .menuitem-label {
  81. opacity: 0;
  82. }
  83. }
  84. .sidebar-menu-item--in-sub-menu {
  85. .menuitem-label {
  86. opacity: 1;
  87. }
  88. }
  89. }