_site-main-navigation.scss 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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:not(.woocommerce-menu-container) {
  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: inline-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. margin: 0;
  51. max-width: none;
  52. padding-left: 0;
  53. position: relative;
  54. ul {
  55. padding-left: 0;
  56. }
  57. li {
  58. display: block;
  59. position: relative;
  60. width: 100%;
  61. z-index: 1;
  62. &:hover,
  63. &:focus-within {
  64. cursor: pointer;
  65. z-index: 99999;
  66. }
  67. &:focus-within a {
  68. // outline: none;
  69. }
  70. @include media(mobile) {
  71. display: inherit;
  72. width: inherit;
  73. /* Submenu display */
  74. &:hover > ul,
  75. &:focus-within > ul,
  76. & ul:hover,
  77. & ul:focus {
  78. visibility: visible;
  79. opacity: 1;
  80. display: block;
  81. }
  82. }
  83. }
  84. & > li {
  85. @include media(mobile) {
  86. & > a {
  87. @include crop-text(map-deep-get($config-header, "main-nav", "font", "line-height"));
  88. }
  89. &:first-of-type > a {
  90. padding-left: 0;
  91. }
  92. &:last-of-type > a {
  93. padding-right: 0;
  94. }
  95. }
  96. }
  97. /* Sub-menus Flyout */
  98. & > li > .sub-menu {
  99. margin: 0;
  100. position: relative;
  101. @include media(mobile) {
  102. background: map-deep-get($config-global, "color", "background", "default");
  103. box-shadow: map-deep-get($config-global, "elevation", "4dp");
  104. left: 0;
  105. top: 100%;
  106. min-width: max-content;
  107. opacity: 0;
  108. position: absolute;
  109. transition: all 0.5s ease;
  110. visibility: hidden;
  111. }
  112. .sub-menu {
  113. width: 100%;
  114. }
  115. }
  116. }
  117. // Menu Link
  118. a {
  119. color: #{map-deep-get($config-header, "main-nav", "color", "link")};
  120. display: block;
  121. @include font-family( map-deep-get($config-header, "main-nav", "font", "family" ) );
  122. font-weight: #{map-deep-get($config-header, "main-nav", "font", "weight")};
  123. padding: #{0.5 * map-deep-get($config-header, "main-nav", "link-padding")} 0;
  124. @include media(mobile) {
  125. padding: #{map-deep-get($config-header, "main-nav", "link-padding")};
  126. }
  127. &:link,
  128. &:visited {
  129. color: #{map-deep-get($config-header, "main-nav", "color", "link")};
  130. }
  131. &:hover {
  132. color: #{map-deep-get($config-header, "main-nav", "color", "link-hover")};
  133. }
  134. }
  135. // Sub-menu depth indicators
  136. .sub-menu {
  137. list-style: none;
  138. margin-left: 0;
  139. /* Reset the counter for each UL */
  140. counter-reset: nested-list;
  141. .menu-item a {
  142. padding-top: #{0.5 * map-deep-get($config-header, "main-nav", "link-padding")};
  143. padding-bottom: #{0.5 * map-deep-get($config-header, "main-nav", "link-padding")};
  144. &::before {
  145. /* Increment the dashes */
  146. counter-increment: nested-list;
  147. /* Insert dashes with spaces in between */
  148. content: "\2013\00a0" counters( nested-list, "\2013\00a0", none );
  149. }
  150. }
  151. }
  152. // Show top-level sub-menu indicators above mobile-breakpoint-only
  153. @include media(mobile) {
  154. & > div > ul > .menu-item-has-children > a {
  155. &::after {
  156. content: "\00a0\25BC";
  157. display: inline-block;
  158. font-size: map-deep-get($config-global, "font", "size", "xs");
  159. height: inherit;
  160. width: inherit;
  161. }
  162. }
  163. }
  164. .hide-visually {
  165. position: absolute !important;
  166. clip: rect(1px, 1px, 1px, 1px);
  167. padding:0 !important;
  168. border:0 !important;
  169. height: 1px !important;
  170. width: 1px !important;
  171. overflow: hidden;
  172. }
  173. }
  174. // Prevent overruling the user defined font size value set inside Gutenberg
  175. // for Full Site Editing's Menu Navigation block.
  176. body:not( .fse-enabled ) {
  177. .main-navigation a {
  178. font-size: #{map-deep-get($config-header, "main-nav", "font", "size")};
  179. }
  180. }