_nav.scss 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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;
  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. .navbar-toggler:focus,
  87. .navbar-toggler:active {
  88. outline: none !important;
  89. box-shadow: none !important;
  90. }
  91. @include media-breakpoint-down(md) { /* Match breakpoint for i18n dropdown in navbar.html. */
  92. .i18n-dropdown .nav-link::after {
  93. // Remove dropdown arrow on small devices (when language name isn't displayed).
  94. content: none;
  95. }
  96. }
  97. // Prevent language and theme selectors rendering off page.
  98. .i18n-dropdown .dropdown-menu,
  99. .theme-dropdown .dropdown-menu {
  100. /* Use style from uncollapsable dropdowns to prevent dropdown going off page. */
  101. position: absolute;
  102. /* Below style from .dropdown-menu-right to prevent dropdown going off page. */
  103. right: 0;
  104. left: auto;
  105. }
  106. // Allow user to horizontally scroll.
  107. // Commented out this feature as it causes dropdowns to appear within the menu bar.
  108. // TODO: re-enable in a way that doesn't break dropdowns.
  109. /*
  110. .navbar .collapse {
  111. overflow-x: auto;
  112. }
  113. */
  114. .navbar-brand {
  115. // Set v-padding to 5px to align with 50/70px responsive max navbar heights.
  116. padding-top: 5px;
  117. padding-bottom: 5px;
  118. font-weight: bold;
  119. position: relative;
  120. z-index: 1030; // For z-index clickable mobile logo.
  121. }
  122. // Dynamically fit logo image to space available.
  123. // No need to explicitly set a size for each breakpoint.
  124. // See https://caniuse.com/#feat=mdn-css_properties_width_stretch .
  125. .navbar-brand img {
  126. width: auto;
  127. height: -moz-available;
  128. height: -webkit-fill-available;
  129. height: -webkit-stretch;
  130. height: stretch;
  131. max-height: 60px; // For lg+ responsive sizing. 60px height +10px v-padding = 70px
  132. max-width: fit-content; // Must override default responsive image style.
  133. }
  134. #navbar-main .main-menu-item ul li .nav-link {
  135. color: $sta-menu-text;
  136. }
  137. .dark #navbar-main .main-menu-item ul li .nav-link {
  138. color: $sta-dark-menu-text;
  139. }
  140. @include media-breakpoint-down(md) {
  141. // Used in conjunction with mobile .navbar-brand to center logo on mobile.
  142. .navbar-brand-mobile-wrapper {
  143. position: absolute;
  144. left: 0;
  145. right: 0;
  146. }
  147. .navbar-brand {
  148. // Center logo in mobile navbar.
  149. margin: 0 auto;
  150. }
  151. .navbar-brand img {
  152. max-height: 40px; // 40px height + 10px v-padding = 50px.
  153. }
  154. .navbar-toggler {
  155. border-color: transparent; // Remove Bootstrap's border from Toggle button.
  156. }
  157. #navbar-main .main-menu-item {
  158. text-align: left !important;
  159. padding-left: 0;
  160. }
  161. .navbar-collapse {
  162. z-index: 1031 !important; // Appear just over navbar.
  163. position: absolute;
  164. left: 0;
  165. top: 50px;
  166. width: 100%;
  167. background-color: $sta-menu-primary;
  168. text-align: center !important;
  169. }
  170. .dark .navbar-collapse {
  171. background-color: $sta-dark-menu-primary;
  172. }
  173. #navbar-main .main-menu-item .nav-item {
  174. padding: 10px 15px !important;
  175. }
  176. #navbar-main .main-menu-item .nav-item .nav-link {
  177. padding: 5px 15px !important;
  178. }
  179. }
  180. ul.nav-icons {
  181. list-style-type: none;
  182. font-size: 18px;
  183. padding: 0.5rem 0 0.5rem 0;
  184. margin: 0;
  185. }
  186. ul.nav-icons li {
  187. display: inline;
  188. padding-right: 1rem;
  189. }
  190. ul.nav-icons li:last-of-type {
  191. padding-right: 0;
  192. }
  193. ul.nav-icons li.nav-item a.nav-link {
  194. padding: 0;
  195. }
  196. .dropdown-menu {
  197. background-color: $sta-menu-primary !important;
  198. color: $sta-menu-text !important;
  199. z-index: 1032; // I18n dropdown over mobile expanded menu.
  200. }
  201. .dark .dropdown-menu {
  202. background-color: $sta-dark-menu-primary !important;
  203. color: $sta-dark-menu-text !important;
  204. }
  205. .dropdown-item {
  206. background-color: $sta-menu-primary !important;
  207. color: $sta-menu-text !important;
  208. }
  209. .dark .dropdown-item {
  210. background-color: $sta-dark-menu-primary !important;
  211. color: $sta-dark-menu-text !important;
  212. }