You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

335 lines
7.4 KiB

  1. // Contents
  2. //
  3. // Navbar
  4. // Navbar brand
  5. // Navbar nav
  6. // Navbar text
  7. // Responsive navbar
  8. // Navbar position
  9. // Navbar themes
  10. // Navbar
  11. //
  12. // Provide a static navbar from which we expand to create full-width, fixed, and
  13. // other navbar variations.
  14. .navbar {
  15. position: relative;
  16. display: flex;
  17. flex-wrap: wrap; // allow us to do the line break for collapsing content
  18. align-items: center;
  19. justify-content: space-between; // space out brand from logo
  20. padding-top: $navbar-padding-y;
  21. padding-right: $navbar-padding-x; // default: null
  22. padding-bottom: $navbar-padding-y;
  23. padding-left: $navbar-padding-x; // default: null
  24. @include gradient-bg();
  25. // Because flex properties aren't inherited, we need to redeclare these first
  26. // few properties so that content nested within behave properly.
  27. // The `flex-wrap` property is inherited to simplify the expanded navbars
  28. %container-flex-properties {
  29. display: flex;
  30. flex-wrap: inherit;
  31. align-items: center;
  32. justify-content: space-between;
  33. }
  34. > .container,
  35. > .container-fluid {
  36. @extend %container-flex-properties;
  37. }
  38. @each $breakpoint, $container-max-width in $container-max-widths {
  39. > .container#{breakpoint-infix($breakpoint, $container-max-widths)} {
  40. @extend %container-flex-properties;
  41. }
  42. }
  43. }
  44. // Navbar brand
  45. //
  46. // Used for brand, project, or site names.
  47. .navbar-brand {
  48. padding-top: $navbar-brand-padding-y;
  49. padding-bottom: $navbar-brand-padding-y;
  50. margin-right: $navbar-brand-margin-end;
  51. @include font-size($navbar-brand-font-size);
  52. text-decoration: if($link-decoration == none, null, none);
  53. white-space: nowrap;
  54. &:hover,
  55. &:focus {
  56. text-decoration: if($link-hover-decoration == underline, none, null);
  57. }
  58. }
  59. // Navbar nav
  60. //
  61. // Custom navbar navigation (doesn't require `.nav`, but does make use of `.nav-link`).
  62. .navbar-nav {
  63. display: flex;
  64. flex-direction: column; // cannot use `inherit` to get the `.navbar`s value
  65. padding-left: 0;
  66. margin-bottom: 0;
  67. list-style: none;
  68. .nav-link {
  69. padding-right: 0;
  70. padding-left: 0;
  71. }
  72. .dropdown-menu {
  73. position: static;
  74. }
  75. }
  76. // Navbar text
  77. //
  78. //
  79. .navbar-text {
  80. padding-top: $nav-link-padding-y;
  81. padding-bottom: $nav-link-padding-y;
  82. }
  83. // Responsive navbar
  84. //
  85. // Custom styles for responsive collapsing and toggling of navbar contents.
  86. // Powered by the collapse Bootstrap JavaScript plugin.
  87. // When collapsed, prevent the toggleable navbar contents from appearing in
  88. // the default flexbox row orientation. Requires the use of `flex-wrap: wrap`
  89. // on the `.navbar` parent.
  90. .navbar-collapse {
  91. flex-basis: 100%;
  92. flex-grow: 1;
  93. // For always expanded or extra full navbars, ensure content aligns itself
  94. // properly vertically. Can be easily overridden with flex utilities.
  95. align-items: center;
  96. }
  97. // Button for toggling the navbar when in its collapsed state
  98. .navbar-toggler {
  99. padding: $navbar-toggler-padding-y $navbar-toggler-padding-x;
  100. @include font-size($navbar-toggler-font-size);
  101. line-height: 1;
  102. background-color: transparent; // remove default button style
  103. border: $border-width solid transparent; // remove default button style
  104. @include border-radius($navbar-toggler-border-radius);
  105. @include transition($navbar-toggler-transition);
  106. &:hover {
  107. text-decoration: none;
  108. }
  109. &:focus {
  110. text-decoration: none;
  111. outline: 0;
  112. box-shadow: 0 0 0 $navbar-toggler-focus-width;
  113. }
  114. }
  115. // Keep as a separate element so folks can easily override it with another icon
  116. // or image file as needed.
  117. .navbar-toggler-icon {
  118. display: inline-block;
  119. width: 1.5em;
  120. height: 1.5em;
  121. vertical-align: middle;
  122. background-repeat: no-repeat;
  123. background-position: center;
  124. background-size: 100%;
  125. }
  126. .navbar-nav-scroll {
  127. max-height: var(--#{$variable-prefix}scroll-height, 75vh);
  128. overflow-y: auto;
  129. }
  130. // scss-docs-start navbar-expand-loop
  131. // Generate series of `.navbar-expand-*` responsive classes for configuring
  132. // where your navbar collapses.
  133. .navbar-expand {
  134. @each $breakpoint in map-keys($grid-breakpoints) {
  135. $next: breakpoint-next($breakpoint, $grid-breakpoints);
  136. $infix: breakpoint-infix($next, $grid-breakpoints);
  137. // stylelint-disable-next-line scss/selector-no-union-class-name
  138. &#{$infix} {
  139. @include media-breakpoint-up($next) {
  140. flex-wrap: nowrap;
  141. justify-content: flex-start;
  142. .navbar-nav {
  143. flex-direction: row;
  144. .dropdown-menu {
  145. position: absolute;
  146. }
  147. .nav-link {
  148. padding-right: $navbar-nav-link-padding-x;
  149. padding-left: $navbar-nav-link-padding-x;
  150. }
  151. }
  152. .navbar-nav-scroll {
  153. overflow: visible;
  154. }
  155. .navbar-collapse {
  156. display: flex !important; // stylelint-disable-line declaration-no-important
  157. flex-basis: auto;
  158. }
  159. .navbar-toggler {
  160. display: none;
  161. }
  162. .offcanvas-header {
  163. display: none;
  164. }
  165. .offcanvas {
  166. position: inherit;
  167. bottom: 0;
  168. z-index: 1000;
  169. flex-grow: 1;
  170. visibility: visible !important; // stylelint-disable-line declaration-no-important
  171. background-color: transparent;
  172. border-right: 0;
  173. border-left: 0;
  174. @include transition(none);
  175. transform: none;
  176. }
  177. .offcanvas-top,
  178. .offcanvas-bottom {
  179. height: auto;
  180. border-top: 0;
  181. border-bottom: 0;
  182. }
  183. .offcanvas-body {
  184. display: flex;
  185. flex-grow: 0;
  186. padding: 0;
  187. overflow-y: visible;
  188. }
  189. }
  190. }
  191. }
  192. }
  193. // scss-docs-end navbar-expand-loop
  194. // Navbar themes
  195. //
  196. // Styles for switching between navbars with light or dark background.
  197. // Dark links against a light background
  198. .navbar-light {
  199. .navbar-brand {
  200. color: $navbar-light-brand-color;
  201. &:hover,
  202. &:focus {
  203. color: $navbar-light-brand-hover-color;
  204. }
  205. }
  206. .navbar-nav {
  207. .nav-link {
  208. color: $navbar-light-color;
  209. &:hover,
  210. &:focus {
  211. color: $navbar-light-hover-color;
  212. }
  213. &.disabled {
  214. color: $navbar-light-disabled-color;
  215. }
  216. }
  217. .show > .nav-link,
  218. .nav-link.active {
  219. color: $navbar-light-active-color;
  220. }
  221. }
  222. .navbar-toggler {
  223. color: $navbar-light-color;
  224. border-color: $navbar-light-toggler-border-color;
  225. }
  226. .navbar-toggler-icon {
  227. background-image: escape-svg($navbar-light-toggler-icon-bg);
  228. }
  229. .navbar-text {
  230. color: $navbar-light-color;
  231. a,
  232. a:hover,
  233. a:focus {
  234. color: $navbar-light-active-color;
  235. }
  236. }
  237. }
  238. // White links against a dark background
  239. .navbar-dark {
  240. .navbar-brand {
  241. color: $navbar-dark-brand-color;
  242. &:hover,
  243. &:focus {
  244. color: $navbar-dark-brand-hover-color;
  245. }
  246. }
  247. .navbar-nav {
  248. .nav-link {
  249. color: $navbar-dark-color;
  250. &:hover,
  251. &:focus {
  252. color: $navbar-dark-hover-color;
  253. }
  254. &.disabled {
  255. color: $navbar-dark-disabled-color;
  256. }
  257. }
  258. .show > .nav-link,
  259. .nav-link.active {
  260. color: $navbar-dark-active-color;
  261. }
  262. }
  263. .navbar-toggler {
  264. color: $navbar-dark-color;
  265. border-color: $navbar-dark-toggler-border-color;
  266. }
  267. .navbar-toggler-icon {
  268. background-image: escape-svg($navbar-dark-toggler-icon-bg);
  269. }
  270. .navbar-text {
  271. color: $navbar-dark-color;
  272. a,
  273. a:hover,
  274. a:focus {
  275. color: $navbar-dark-active-color;
  276. }
  277. }
  278. }