navbar.sass 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. @import "../utilities/mixins"
  2. $navbar-background-color: $scheme-main !default
  3. $navbar-box-shadow-size: 0 2px 0 0 !default
  4. $navbar-box-shadow-color: $background !default
  5. $navbar-height: 3.25rem !default
  6. $navbar-padding-vertical: 1rem !default
  7. $navbar-padding-horizontal: 2rem !default
  8. $navbar-z: 30 !default
  9. $navbar-fixed-z: 30 !default
  10. $navbar-item-color: $text !default
  11. $navbar-item-hover-color: $link !default
  12. $navbar-item-hover-background-color: $scheme-main-bis !default
  13. $navbar-item-active-color: $scheme-invert !default
  14. $navbar-item-active-background-color: transparent !default
  15. $navbar-item-img-max-height: 1.75rem !default
  16. $navbar-burger-color: $navbar-item-color !default
  17. $navbar-tab-hover-background-color: transparent !default
  18. $navbar-tab-hover-border-bottom-color: $link !default
  19. $navbar-tab-active-color: $link !default
  20. $navbar-tab-active-background-color: transparent !default
  21. $navbar-tab-active-border-bottom-color: $link !default
  22. $navbar-tab-active-border-bottom-style: solid !default
  23. $navbar-tab-active-border-bottom-width: 3px !default
  24. $navbar-dropdown-background-color: $scheme-main !default
  25. $navbar-dropdown-border-top: 2px solid $border !default
  26. $navbar-dropdown-offset: -4px !default
  27. $navbar-dropdown-arrow: $link !default
  28. $navbar-dropdown-radius: $radius-large !default
  29. $navbar-dropdown-z: 20 !default
  30. $navbar-dropdown-boxed-radius: $radius-large !default
  31. $navbar-dropdown-boxed-shadow: 0 8px 8px bulmaRgba($scheme-invert, 0.1), 0 0 0 1px bulmaRgba($scheme-invert, 0.1) !default
  32. $navbar-dropdown-item-hover-color: $scheme-invert !default
  33. $navbar-dropdown-item-hover-background-color: $background !default
  34. $navbar-dropdown-item-active-color: $link !default
  35. $navbar-dropdown-item-active-background-color: $background !default
  36. $navbar-divider-background-color: $background !default
  37. $navbar-divider-height: 2px !default
  38. $navbar-bottom-box-shadow-size: 0 -2px 0 0 !default
  39. $navbar-breakpoint: $desktop !default
  40. $navbar-colors: $colors !default
  41. =navbar-fixed
  42. left: 0
  43. position: fixed
  44. right: 0
  45. z-index: $navbar-fixed-z
  46. .navbar
  47. background-color: $navbar-background-color
  48. min-height: $navbar-height
  49. position: relative
  50. z-index: $navbar-z
  51. @each $name, $pair in $navbar-colors
  52. $color: nth($pair, 1)
  53. $color-invert: nth($pair, 2)
  54. &.is-#{$name}
  55. background-color: $color
  56. color: $color-invert
  57. .navbar-brand
  58. & > .navbar-item,
  59. .navbar-link
  60. color: $color-invert
  61. & > a.navbar-item,
  62. .navbar-link
  63. &:focus,
  64. &:hover,
  65. &.is-active
  66. background-color: bulmaDarken($color, 5%)
  67. color: $color-invert
  68. .navbar-link
  69. &::after
  70. border-color: $color-invert
  71. .navbar-burger
  72. color: $color-invert
  73. +from($navbar-breakpoint)
  74. .navbar-start,
  75. .navbar-end
  76. & > .navbar-item,
  77. .navbar-link
  78. color: $color-invert
  79. & > a.navbar-item,
  80. .navbar-link
  81. &:focus,
  82. &:hover,
  83. &.is-active
  84. background-color: bulmaDarken($color, 5%)
  85. color: $color-invert
  86. .navbar-link
  87. &::after
  88. border-color: $color-invert
  89. .navbar-item.has-dropdown:focus .navbar-link,
  90. .navbar-item.has-dropdown:hover .navbar-link,
  91. .navbar-item.has-dropdown.is-active .navbar-link
  92. background-color: bulmaDarken($color, 5%)
  93. color: $color-invert
  94. .navbar-dropdown
  95. a.navbar-item
  96. &.is-active
  97. background-color: $color
  98. color: $color-invert
  99. & > .container
  100. align-items: stretch
  101. display: flex
  102. min-height: $navbar-height
  103. width: 100%
  104. &.has-shadow
  105. box-shadow: $navbar-box-shadow-size $navbar-box-shadow-color
  106. &.is-fixed-bottom,
  107. &.is-fixed-top
  108. +navbar-fixed
  109. &.is-fixed-bottom
  110. bottom: 0
  111. &.has-shadow
  112. box-shadow: $navbar-bottom-box-shadow-size $navbar-box-shadow-color
  113. &.is-fixed-top
  114. top: 0
  115. html,
  116. body
  117. &.has-navbar-fixed-top
  118. padding-top: $navbar-height
  119. &.has-navbar-fixed-bottom
  120. padding-bottom: $navbar-height
  121. .navbar-brand,
  122. .navbar-tabs
  123. align-items: stretch
  124. display: flex
  125. flex-shrink: 0
  126. min-height: $navbar-height
  127. .navbar-brand
  128. a.navbar-item
  129. &:focus,
  130. &:hover
  131. background-color: transparent
  132. .navbar-tabs
  133. +overflow-touch
  134. max-width: 100vw
  135. overflow-x: auto
  136. overflow-y: hidden
  137. .navbar-burger
  138. color: $navbar-burger-color
  139. +hamburger($navbar-height)
  140. +ltr-property("margin", auto, false)
  141. .navbar-menu
  142. display: none
  143. .navbar-item,
  144. .navbar-link
  145. color: $navbar-item-color
  146. display: block
  147. line-height: 1.5
  148. padding: 0.5rem 0.75rem
  149. position: relative
  150. .icon
  151. &:only-child
  152. margin-left: -0.25rem
  153. margin-right: -0.25rem
  154. a.navbar-item,
  155. .navbar-link
  156. cursor: pointer
  157. &:focus,
  158. &:focus-within,
  159. &:hover,
  160. &.is-active
  161. background-color: $navbar-item-hover-background-color
  162. color: $navbar-item-hover-color
  163. .navbar-item
  164. flex-grow: 0
  165. flex-shrink: 0
  166. img
  167. max-height: $navbar-item-img-max-height
  168. &.has-dropdown
  169. padding: 0
  170. &.is-expanded
  171. flex-grow: 1
  172. flex-shrink: 1
  173. &.is-tab
  174. border-bottom: 1px solid transparent
  175. min-height: $navbar-height
  176. padding-bottom: calc(0.5rem - 1px)
  177. &:focus,
  178. &:hover
  179. background-color: $navbar-tab-hover-background-color
  180. border-bottom-color: $navbar-tab-hover-border-bottom-color
  181. &.is-active
  182. background-color: $navbar-tab-active-background-color
  183. border-bottom-color: $navbar-tab-active-border-bottom-color
  184. border-bottom-style: $navbar-tab-active-border-bottom-style
  185. border-bottom-width: $navbar-tab-active-border-bottom-width
  186. color: $navbar-tab-active-color
  187. padding-bottom: calc(0.5rem - #{$navbar-tab-active-border-bottom-width})
  188. .navbar-content
  189. flex-grow: 1
  190. flex-shrink: 1
  191. .navbar-link:not(.is-arrowless)
  192. +ltr-property("padding", 2.5em)
  193. &::after
  194. @extend %arrow
  195. border-color: $navbar-dropdown-arrow
  196. margin-top: -0.375em
  197. +ltr-position(1.125em)
  198. .navbar-dropdown
  199. font-size: 0.875rem
  200. padding-bottom: 0.5rem
  201. padding-top: 0.5rem
  202. .navbar-item
  203. padding-left: 1.5rem
  204. padding-right: 1.5rem
  205. .navbar-divider
  206. background-color: $navbar-divider-background-color
  207. border: none
  208. display: none
  209. height: $navbar-divider-height
  210. margin: 0.5rem 0
  211. +until($navbar-breakpoint)
  212. .navbar > .container
  213. display: block
  214. .navbar-brand,
  215. .navbar-tabs
  216. .navbar-item
  217. align-items: center
  218. display: flex
  219. .navbar-link
  220. &::after
  221. display: none
  222. .navbar-menu
  223. background-color: $navbar-background-color
  224. box-shadow: 0 8px 16px bulmaRgba($scheme-invert, 0.1)
  225. padding: 0.5rem 0
  226. &.is-active
  227. display: block
  228. // Fixed navbar
  229. .navbar
  230. &.is-fixed-bottom-touch,
  231. &.is-fixed-top-touch
  232. +navbar-fixed
  233. &.is-fixed-bottom-touch
  234. bottom: 0
  235. &.has-shadow
  236. box-shadow: 0 -2px 3px bulmaRgba($scheme-invert, 0.1)
  237. &.is-fixed-top-touch
  238. top: 0
  239. &.is-fixed-top,
  240. &.is-fixed-top-touch
  241. .navbar-menu
  242. +overflow-touch
  243. max-height: calc(100vh - #{$navbar-height})
  244. overflow: auto
  245. html,
  246. body
  247. &.has-navbar-fixed-top-touch
  248. padding-top: $navbar-height
  249. &.has-navbar-fixed-bottom-touch
  250. padding-bottom: $navbar-height
  251. +from($navbar-breakpoint)
  252. .navbar,
  253. .navbar-menu,
  254. .navbar-start,
  255. .navbar-end
  256. align-items: stretch
  257. display: flex
  258. .navbar
  259. min-height: $navbar-height
  260. &.is-spaced
  261. padding: $navbar-padding-vertical $navbar-padding-horizontal
  262. .navbar-start,
  263. .navbar-end
  264. align-items: center
  265. a.navbar-item,
  266. .navbar-link
  267. border-radius: $radius
  268. &.is-transparent
  269. a.navbar-item,
  270. .navbar-link
  271. &:focus,
  272. &:hover,
  273. &.is-active
  274. background-color: transparent !important
  275. .navbar-item.has-dropdown
  276. &.is-active,
  277. &.is-hoverable:focus,
  278. &.is-hoverable:focus-within,
  279. &.is-hoverable:hover
  280. .navbar-link
  281. background-color: transparent !important
  282. .navbar-dropdown
  283. a.navbar-item
  284. &:focus,
  285. &:hover
  286. background-color: $navbar-dropdown-item-hover-background-color
  287. color: $navbar-dropdown-item-hover-color
  288. &.is-active
  289. background-color: $navbar-dropdown-item-active-background-color
  290. color: $navbar-dropdown-item-active-color
  291. .navbar-burger
  292. display: none
  293. .navbar-item,
  294. .navbar-link
  295. align-items: center
  296. display: flex
  297. .navbar-item
  298. &.has-dropdown
  299. align-items: stretch
  300. &.has-dropdown-up
  301. .navbar-link::after
  302. transform: rotate(135deg) translate(0.25em, -0.25em)
  303. .navbar-dropdown
  304. border-bottom: $navbar-dropdown-border-top
  305. border-radius: $navbar-dropdown-radius $navbar-dropdown-radius 0 0
  306. border-top: none
  307. bottom: 100%
  308. box-shadow: 0 -8px 8px bulmaRgba($scheme-invert, 0.1)
  309. top: auto
  310. &.is-active,
  311. &.is-hoverable:focus,
  312. &.is-hoverable:focus-within,
  313. &.is-hoverable:hover
  314. .navbar-dropdown
  315. display: block
  316. .navbar.is-spaced &,
  317. &.is-boxed
  318. opacity: 1
  319. pointer-events: auto
  320. transform: translateY(0)
  321. .navbar-menu
  322. flex-grow: 1
  323. flex-shrink: 0
  324. .navbar-start
  325. justify-content: flex-start
  326. +ltr-property("margin", auto)
  327. .navbar-end
  328. justify-content: flex-end
  329. +ltr-property("margin", auto, false)
  330. .navbar-dropdown
  331. background-color: $navbar-dropdown-background-color
  332. border-bottom-left-radius: $navbar-dropdown-radius
  333. border-bottom-right-radius: $navbar-dropdown-radius
  334. border-top: $navbar-dropdown-border-top
  335. box-shadow: 0 8px 8px bulmaRgba($scheme-invert, 0.1)
  336. display: none
  337. font-size: 0.875rem
  338. +ltr-position(0, false)
  339. min-width: 100%
  340. position: absolute
  341. top: 100%
  342. z-index: $navbar-dropdown-z
  343. .navbar-item
  344. padding: 0.375rem 1rem
  345. white-space: nowrap
  346. a.navbar-item
  347. +ltr-property("padding", 3rem)
  348. &:focus,
  349. &:hover
  350. background-color: $navbar-dropdown-item-hover-background-color
  351. color: $navbar-dropdown-item-hover-color
  352. &.is-active
  353. background-color: $navbar-dropdown-item-active-background-color
  354. color: $navbar-dropdown-item-active-color
  355. .navbar.is-spaced &,
  356. &.is-boxed
  357. border-radius: $navbar-dropdown-boxed-radius
  358. border-top: none
  359. box-shadow: $navbar-dropdown-boxed-shadow
  360. display: block
  361. opacity: 0
  362. pointer-events: none
  363. top: calc(100% + (#{$navbar-dropdown-offset}))
  364. transform: translateY(-5px)
  365. transition-duration: $speed
  366. transition-property: opacity, transform
  367. &.is-right
  368. left: auto
  369. right: 0
  370. .navbar-divider
  371. display: block
  372. .navbar > .container,
  373. .container > .navbar
  374. .navbar-brand
  375. +ltr-property("margin", -.75rem, false)
  376. .navbar-menu
  377. +ltr-property("margin", -.75rem)
  378. // Fixed navbar
  379. .navbar
  380. &.is-fixed-bottom-desktop,
  381. &.is-fixed-top-desktop
  382. +navbar-fixed
  383. &.is-fixed-bottom-desktop
  384. bottom: 0
  385. &.has-shadow
  386. box-shadow: 0 -2px 3px bulmaRgba($scheme-invert, 0.1)
  387. &.is-fixed-top-desktop
  388. top: 0
  389. html,
  390. body
  391. &.has-navbar-fixed-top-desktop
  392. padding-top: $navbar-height
  393. &.has-navbar-fixed-bottom-desktop
  394. padding-bottom: $navbar-height
  395. &.has-spaced-navbar-fixed-top
  396. padding-top: $navbar-height + ($navbar-padding-vertical * 2)
  397. &.has-spaced-navbar-fixed-bottom
  398. padding-bottom: $navbar-height + ($navbar-padding-vertical * 2)
  399. // Hover/Active states
  400. a.navbar-item,
  401. .navbar-link
  402. &.is-active
  403. color: $navbar-item-active-color
  404. &.is-active:not(:focus):not(:hover)
  405. background-color: $navbar-item-active-background-color
  406. .navbar-item.has-dropdown
  407. &:focus,
  408. &:hover,
  409. &.is-active
  410. .navbar-link
  411. background-color: $navbar-item-hover-background-color
  412. // Combination
  413. .hero
  414. &.is-fullheight-with-navbar
  415. min-height: calc(100vh - #{$navbar-height})