_nav.scss 5.0 KB

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