_site-main-navigation.scss 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. // Navigation
  2. .main-navigation {
  3. color: #{map-deep-get($config-header, "main-nav", "color", "text")};
  4. // Menu wrapper
  5. & > div {
  6. display: none;
  7. }
  8. // Mobile menu toggle
  9. #toggle-menu {
  10. display: inline-block;
  11. margin: 0;
  12. }
  13. // Checkbox hack
  14. #toggle:checked ~ div {
  15. display: block;
  16. }
  17. #toggle:focus + #toggle-menu {
  18. background-color: #{map-deep-get($config-header, "main-nav", "color", "link-hover")};
  19. outline: inherit;
  20. text-decoration: underline;
  21. }
  22. .dropdown-icon.close {
  23. display: none;
  24. }
  25. #toggle:checked + #toggle-menu {
  26. .open {
  27. display: none;
  28. }
  29. .close {
  30. display: inline;
  31. }
  32. }
  33. @include media(mobile) {
  34. & > div {
  35. display: block;
  36. }
  37. #toggle-menu {
  38. display: none;
  39. }
  40. // Hide sub-sub-menus
  41. & > div > ul > li > ul {
  42. display: none;
  43. }
  44. }
  45. // Menu list wrapper
  46. & > div > ul {
  47. display: flex;
  48. flex-wrap: wrap;
  49. list-style: none;
  50. max-width: none;
  51. margin: 0 #{-1 * map-deep-get($config-global, "spacing", "unit")};
  52. position: relative;
  53. li {
  54. display: block;
  55. position: relative;
  56. width: 100%;
  57. z-index: 1;
  58. &:hover,
  59. &:focus-within {
  60. cursor: pointer;
  61. z-index: 99999;
  62. }
  63. &:focus-within a {
  64. // outline: none;
  65. }
  66. @include media(mobile) {
  67. display: inherit;
  68. width: inherit;
  69. /* Submenu display */
  70. &:hover > ul,
  71. &:focus-within > ul,
  72. & ul:hover,
  73. & ul:focus {
  74. visibility: visible;
  75. opacity: 1;
  76. display: block;
  77. }
  78. }
  79. }
  80. & > li > a {
  81. @include crop-text(map-deep-get($config-header, "main-nav", "font", "line-height"));
  82. }
  83. /* Sub-menus Flyout */
  84. & > li > .sub-menu {
  85. margin: 0;
  86. position: relative;
  87. @include media(mobile) {
  88. background: map-deep-get($config-global, "color", "background");
  89. box-shadow: map-deep-get($config-global, "elevation", "4dp");
  90. left: 0;
  91. top: 100%;
  92. min-width: max-content;
  93. opacity: 0;
  94. position: absolute;
  95. transition: all 0.5s ease;
  96. visibility: hidden;
  97. }
  98. .sub-menu {
  99. width: 100%;
  100. }
  101. }
  102. }
  103. // Menu Link
  104. a {
  105. color: #{map-deep-get($config-header, "main-nav", "color", "link")};
  106. display: block;
  107. font-family: #{map-deep-get($config-header, "main-nav", "font", "family")};
  108. font-size: #{map-deep-get($config-header, "main-nav", "font", "size")};
  109. font-weight: #{map-deep-get($config-header, "main-nav", "font", "weight")};
  110. padding: #{map-deep-get($config-header, "main-nav", "link-padding")};
  111. &:link,
  112. &:visited {
  113. color: #{map-deep-get($config-header, "main-nav", "color", "link")};
  114. }
  115. &:hover {
  116. color: #{map-deep-get($config-header, "main-nav", "color", "link-hover")};
  117. }
  118. }
  119. // Sub-menu depth indicators
  120. .sub-menu {
  121. list-style: none;
  122. margin-left: 0;
  123. /* Reset the counter for each UL */
  124. counter-reset: nested-list;
  125. .menu-item a {
  126. padding-top: #{0.5 * map-deep-get($config-header, "main-nav", "link-padding")};
  127. padding-bottom: #{0.5 * map-deep-get($config-header, "main-nav", "link-padding")};
  128. &::before {
  129. /* Increment the dashes */
  130. counter-increment: nested-list;
  131. /* Insert dashes with spaces in between */
  132. content: "\2013\00a0" counters( nested-list, "\2013\00a0", none );
  133. }
  134. }
  135. }
  136. // Show top-level sub-menu indicators above mobile-breakpoint-only
  137. @include media(mobile) {
  138. & > div > ul > .menu-item-has-children > a {
  139. &::after {
  140. content: "\00a0\25BC";
  141. display: inline-block;
  142. font-size: map-deep-get($config-global, "font", "size", "xs");
  143. height: inherit;
  144. width: inherit;
  145. }
  146. }
  147. }
  148. .hide-visually {
  149. position: absolute !important;
  150. clip: rect(1px, 1px, 1px, 1px);
  151. padding:0 !important;
  152. border:0 !important;
  153. height: 1px !important;
  154. width: 1px !important;
  155. overflow: hidden;
  156. }
  157. }