_nav.scss 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /*************************************************
  2. * Navigation bar
  3. **************************************************/
  4. .navbar {
  5. height: 70px;
  6. background: $sta-menu-primary;
  7. box-shadow: 0 0.125rem 0.25rem 0 rgba(0,0,0,.11);
  8. font-size: #{$sta-font-size-small}px;
  9. position: fixed;
  10. top: 0;
  11. right: 0;
  12. left: 0;
  13. z-index: 1030;
  14. // Remove Bootstrap's navbar v-padding and assign v-padding to logo separately to maximise logo size.
  15. // Otherwise, Bootstrap's navbar v-padding causes issue with logo fitting within fixed 50px height bar in md-lg sizes.
  16. padding: 0 1rem;
  17. .nav-item {
  18. // For z-index compatibility with logo on mobile layout, otherwise nav-item can't be clicked when logo present.
  19. position: relative;
  20. }
  21. @include media-breakpoint-down(md) {
  22. height: 50px;
  23. .navbar-nav-scroll {
  24. width: 100%;
  25. overflow: hidden;
  26. .navbar-nav {
  27. overflow-x: auto;
  28. white-space: nowrap;
  29. -webkit-overflow-scrolling: touch;
  30. }
  31. }
  32. }
  33. .navbar-nav {
  34. display: flex;
  35. .nav-link {
  36. color: rgba($sta-menu-text, .85);
  37. &.active,
  38. &:hover,
  39. &:focus {
  40. color: $sta-menu-text;
  41. }
  42. &.active {
  43. font-weight: bold !important;
  44. color: $sta-menu-text-active !important;
  45. }
  46. }
  47. }
  48. .dropdown-menu {
  49. font-size: #{$sta-font-size-small}px;
  50. }
  51. // Note: dedicated `dropdown-item-active` class to prevent ScrollSpy removing `active` class from language chooser.
  52. .dropdown-item.active,
  53. .dropdown-item-active {
  54. font-weight: bold;
  55. color: $sta-menu-text-active !important;
  56. }
  57. }
  58. .dark .navbar {
  59. background: $sta-dark-menu-primary;
  60. box-shadow: 0 0.125rem 0.25rem 0 rgba(255, 255, 255, .11);
  61. .navbar-nav {
  62. .nav-link {
  63. color: rgba($sta-dark-menu-text, .85);
  64. &.active,
  65. &:hover,
  66. &:focus {
  67. color: $sta-dark-menu-text-active;
  68. }
  69. &.active {
  70. font-weight: bold !important;
  71. color: $sta-dark-menu-text-active !important;
  72. }
  73. }
  74. }
  75. .dropdown-item.active,
  76. .dropdown-item-active {
  77. color: $sta-dark-menu-text-active !important;
  78. }
  79. }
  80. // Remove Bootstrap's border from Toggle button.
  81. .navbar-toggler {
  82. border: 0 !important;
  83. position: relative; // For z-index clickable mobile logo.
  84. z-index: 1030;
  85. }
  86. .dark .navbar-toggler {
  87. color: $sta-dark-menu-text;
  88. }
  89. .navbar-toggler:focus,
  90. .navbar-toggler:active {
  91. outline: none !important;
  92. box-shadow: none !important;
  93. }
  94. @include media-breakpoint-down(md) { /* Match breakpoint for i18n dropdown in navbar.html. */
  95. .i18n-dropdown .nav-link::after {
  96. // Remove dropdown arrow on small devices (when language name isn't displayed).
  97. content: none;
  98. }
  99. }
  100. // Prevent language and theme selectors rendering off page.
  101. .i18n-dropdown .dropdown-menu,
  102. .theme-dropdown .dropdown-menu {
  103. /* Use style from uncollapsable dropdowns to prevent dropdown going off page. */
  104. position: absolute;
  105. /* Below style from .dropdown-menu-right to prevent dropdown going off page. */
  106. right: 0;
  107. left: auto;
  108. }
  109. // Allow user to horizontally scroll.
  110. // Commented out this feature as it causes dropdowns to appear within the menu bar.
  111. // TODO: re-enable in a way that doesn't break dropdowns.
  112. /*
  113. .navbar .collapse {
  114. overflow-x: auto;
  115. }
  116. */
  117. .navbar-brand {
  118. // Set v-padding to 5px to align with 50/70px responsive max navbar heights.
  119. padding-top: 5px;
  120. padding-bottom: 5px;
  121. font-weight: bold;
  122. position: relative;
  123. z-index: 1030; // For z-index clickable mobile logo.
  124. }
  125. .dark .navbar-brand {
  126. color: $sta-dark-menu-title;
  127. }
  128. // Dynamically fit logo image to space available.
  129. // No need to explicitly set a size for each breakpoint.
  130. // See https://caniuse.com/#feat=mdn-css_properties_width_stretch .
  131. .navbar-brand img {
  132. width: auto;
  133. height: -moz-available;
  134. height: -webkit-fill-available;
  135. height: -webkit-stretch;
  136. height: stretch;
  137. max-height: 60px; // For lg+ responsive sizing. 60px height +10px v-padding = 70px
  138. max-width: fit-content; // Must override default responsive image style.
  139. }
  140. #navbar-main .main-menu-item ul li .nav-link {
  141. color: $sta-menu-text;
  142. }
  143. .dark #navbar-main .main-menu-item ul li .nav-link {
  144. color: $sta-dark-menu-text;
  145. }
  146. @include media-breakpoint-down(md) {
  147. // Used in conjunction with mobile .navbar-brand to center logo on mobile.
  148. .navbar-brand-mobile-wrapper {
  149. position: absolute;
  150. left: 0;
  151. right: 0;
  152. }
  153. .navbar-brand {
  154. // Center logo in mobile navbar.
  155. margin: 0 auto;
  156. }
  157. .navbar-brand img {
  158. max-height: 40px; // 40px height + 10px v-padding = 50px.
  159. }
  160. .navbar-toggler {
  161. border-color: transparent; // Remove Bootstrap's border from Toggle button.
  162. }
  163. #navbar-main .main-menu-item {
  164. text-align: left !important;
  165. padding-left: 0;
  166. }
  167. .navbar-collapse {
  168. z-index: 1031 !important; // Appear just over navbar.
  169. position: absolute;
  170. left: 0;
  171. top: 50px;
  172. width: 100%;
  173. background-color: $sta-menu-primary;
  174. text-align: center !important;
  175. }
  176. .dark .navbar-collapse {
  177. background-color: $sta-dark-menu-primary;
  178. }
  179. #navbar-main .main-menu-item .nav-item {
  180. padding: 10px 15px !important;
  181. }
  182. #navbar-main .main-menu-item .nav-item .nav-link {
  183. padding: 5px 15px !important;
  184. }
  185. }
  186. ul.nav-icons {
  187. list-style-type: none;
  188. font-size: 18px;
  189. padding: 0.5rem 0 0.5rem 0;
  190. margin: 0;
  191. }
  192. ul.nav-icons li {
  193. display: inline;
  194. padding-right: 1rem;
  195. }
  196. ul.nav-icons li:last-of-type {
  197. padding-right: 0;
  198. }
  199. ul.nav-icons li.nav-item a.nav-link {
  200. padding: 0;
  201. }
  202. .dropdown-menu {
  203. background-color: $sta-menu-primary !important;
  204. color: $sta-menu-text !important;
  205. z-index: 1032; // I18n dropdown over mobile expanded menu.
  206. }
  207. .dark .dropdown-menu {
  208. background-color: $sta-dark-menu-primary !important;
  209. color: $sta-dark-menu-text !important;
  210. }
  211. .dropdown-item {
  212. background-color: $sta-menu-primary !important;
  213. color: $sta-menu-text !important;
  214. }
  215. .dark .dropdown-item {
  216. background-color: $sta-dark-menu-primary !important;
  217. color: $sta-dark-menu-text !important;
  218. }