_nav.scss 4.8 KB

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