bulma/sass/components/navbar.sass

376 lines
9.8 KiB
Sass
Raw Normal View History

2017-07-28 20:05:15 +00:00
$navbar-background-color: $white !default
2017-06-30 22:47:22 +00:00
$navbar-height: 3.25rem !default
2017-10-24 09:31:45 +00:00
$navbar-fixed-z: 30 !default
2017-06-30 22:47:22 +00:00
2017-07-28 20:05:15 +00:00
$navbar-item-color: $grey-dark !default
2017-10-26 16:54:26 +00:00
$navbar-item-hover-color: $link !default
2017-07-28 20:05:15 +00:00
$navbar-item-hover-background-color: $background !default
$navbar-item-active-color: $black !default
$navbar-item-active-background-color: transparent !default
2017-08-07 18:55:21 +00:00
$navbar-item-img-max-height: 1.75rem !default
2017-07-28 20:05:15 +00:00
$navbar-tab-hover-background-color: transparent !default
2017-10-07 16:31:05 +00:00
$navbar-tab-hover-border-bottom-color: $link !default
$navbar-tab-active-color: $link !default
2017-07-28 20:05:15 +00:00
$navbar-tab-active-background-color: transparent !default
2017-10-07 16:31:05 +00:00
$navbar-tab-active-border-bottom-color: $link !default
2017-07-28 20:05:15 +00:00
$navbar-tab-active-border-bottom-style: solid !default
$navbar-tab-active-border-bottom-width: 3px !default
$navbar-dropdown-background-color: $white !default
$navbar-dropdown-border-top: 1px solid $border !default
2017-06-30 22:47:22 +00:00
$navbar-dropdown-offset: -4px !default
$navbar-dropdown-arrow: $link !default
$navbar-dropdown-radius: $radius-large !default
2017-07-02 15:52:20 +00:00
$navbar-dropdown-z: 20 !default
2017-06-30 21:34:13 +00:00
2017-07-28 20:05:15 +00:00
$navbar-dropdown-boxed-radius: $radius-large !default
$navbar-dropdown-boxed-shadow: 0 8px 8px rgba($black, 0.1), 0 0 0 1px rgba($black, 0.1) !default
$navbar-dropdown-item-hover-color: $black !default
$navbar-dropdown-item-hover-background-color: $background !default
2017-10-07 16:31:05 +00:00
$navbar-dropdown-item-active-color: $link !default
2017-07-28 20:05:15 +00:00
$navbar-dropdown-item-active-background-color: $background !default
2017-06-30 22:47:22 +00:00
2017-07-28 20:05:15 +00:00
$navbar-divider-background-color: $border !default
2017-06-30 21:34:13 +00:00
2017-10-24 09:31:45 +00:00
=navbar-fixed
left: 0
position: fixed
right: 0
z-index: $navbar-fixed-z
2017-06-30 21:34:13 +00:00
.navbar
2017-07-28 20:05:15 +00:00
background-color: $navbar-background-color
2017-06-30 21:34:13 +00:00
min-height: $navbar-height
position: relative
@each $name, $pair in $colors
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
&.is-#{$name}
background-color: $color
color: $color-invert
2017-09-10 16:16:12 +00:00
.navbar-brand
& > .navbar-item,
.navbar-link
color: $color-invert
& > a.navbar-item,
.navbar-link
&:hover,
&.is-active
background-color: darken($color, 5%)
color: $color-invert
.navbar-link
&::after
border-color: $color-invert
+desktop
2017-09-09 21:56:54 +00:00
.navbar-start,
.navbar-end
& > .navbar-item,
2017-09-10 16:04:54 +00:00
.navbar-link
2017-09-09 21:56:54 +00:00
color: $color-invert
& > a.navbar-item,
2017-09-10 16:04:54 +00:00
.navbar-link
2017-09-09 21:56:54 +00:00
&:hover,
&.is-active
2017-09-10 16:04:54 +00:00
background-color: darken($color, 5%)
2017-09-09 21:56:54 +00:00
color: $color-invert
.navbar-link
&::after
border-color: $color-invert
.navbar-item.has-dropdown:hover .navbar-link,
.navbar-item.has-dropdown.is-active .navbar-link
2017-09-10 16:04:54 +00:00
background-color: darken($color, 5%)
color: $color-invert
2017-09-09 21:56:54 +00:00
.navbar-dropdown
a.navbar-item
&.is-active
2017-09-10 16:16:12 +00:00
background-color: $color
color: $color-invert
2017-07-16 18:44:28 +00:00
& > .container
align-items: stretch
display: flex
min-height: $navbar-height
width: 100%
&.has-shadow
box-shadow: 0 2px 3px rgba($black, 0.1)
2017-10-24 09:31:45 +00:00
&.is-fixed-bottom,
&.is-fixed-top
+navbar-fixed
&.is-fixed-bottom
bottom: 0
2017-10-24 11:23:31 +00:00
&.has-shadow
box-shadow: 0 -2px 3px rgba($black, 0.1)
2017-10-24 09:31:45 +00:00
&.is-fixed-top
top: 0
html.has-navbar-fixed-top,
body.has-navbar-fixed-top
2017-10-24 09:31:45 +00:00
padding-top: $navbar-height
html.has-navbar-fixed-bottom,
body.has-navbar-fixed-bottom
2017-10-24 09:31:45 +00:00
padding-bottom: $navbar-height
2017-06-30 21:34:13 +00:00
2017-09-05 13:09:31 +00:00
.navbar-brand,
.navbar-tabs
2017-06-30 21:34:13 +00:00
align-items: stretch
display: flex
2017-07-30 17:22:13 +00:00
flex-shrink: 0
2017-07-16 18:44:28 +00:00
min-height: $navbar-height
2017-09-05 13:09:31 +00:00
.navbar-tabs
+overflow-touch
max-width: 100vw
2017-07-16 18:44:28 +00:00
overflow-x: auto
overflow-y: hidden
2017-06-30 21:34:13 +00:00
.navbar-burger
+hamburger($navbar-height)
margin-left: auto
2017-06-30 22:47:22 +00:00
.navbar-menu
display: none
2017-06-30 21:34:13 +00:00
.navbar-item,
.navbar-link
2017-07-28 20:05:15 +00:00
color: $navbar-item-color
2017-06-30 22:16:22 +00:00
display: block
2017-06-30 21:34:13 +00:00
line-height: 1.5
padding: 0.5rem 1rem
position: relative
2017-07-02 22:39:08 +00:00
a.navbar-item,
2017-10-26 16:54:26 +00:00
a.navbar-link
2017-07-02 22:39:08 +00:00
&:hover,
&.is-active
2017-07-28 20:05:15 +00:00
background-color: $navbar-item-hover-background-color
color: $navbar-item-hover-color
2017-06-30 21:34:13 +00:00
.navbar-item
flex-grow: 0
flex-shrink: 0
img
2017-08-07 18:55:21 +00:00
max-height: $navbar-item-img-max-height
2017-06-30 21:34:13 +00:00
&.has-dropdown
padding: 0
&.is-expanded
flex-grow: 1
flex-shrink: 1
2017-07-16 18:44:28 +00:00
&.is-tab
border-bottom: 1px solid transparent
min-height: $navbar-height
padding-bottom: calc(0.5rem - 1px)
&:hover
2017-07-28 20:05:15 +00:00
background-color: $navbar-tab-hover-background-color
border-bottom-color: $navbar-tab-hover-border-bottom-color
2017-07-16 18:44:28 +00:00
&.is-active
2017-07-28 20:05:15 +00:00
background-color: $navbar-tab-active-background-color
border-bottom-color: $navbar-tab-active-border-bottom-color
border-bottom-style: $navbar-tab-active-border-bottom-style
border-bottom-width: $navbar-tab-active-border-bottom-width
color: $navbar-tab-active-color
padding-bottom: calc(0.5rem - #{$navbar-tab-active-border-bottom-width})
2017-06-30 21:34:13 +00:00
.navbar-content
flex-grow: 1
flex-shrink: 1
.navbar-link
padding-right: 2.5em
.navbar-dropdown
font-size: 0.875rem
2017-06-30 22:16:22 +00:00
padding-bottom: 0.5rem
padding-top: 0.5rem
2017-06-30 21:34:13 +00:00
.navbar-item
2017-06-30 22:16:22 +00:00
padding-left: 1.5rem
padding-right: 1.5rem
2017-06-30 21:34:13 +00:00
.navbar-divider
2017-07-28 20:05:15 +00:00
background-color: $navbar-divider-background-color
2017-06-30 21:34:13 +00:00
border: none
2017-06-30 22:16:22 +00:00
display: none
2017-06-30 21:34:13 +00:00
height: 1px
2017-06-30 22:16:22 +00:00
margin: 0.5rem 0
2017-06-30 21:34:13 +00:00
2017-06-30 22:16:22 +00:00
+touch
.navbar > .container
display: block
2017-09-05 13:09:31 +00:00
.navbar-brand,
.navbar-tabs
2017-06-30 22:16:22 +00:00
.navbar-item
align-items: center
display: flex
2017-06-30 21:34:13 +00:00
.navbar-menu
background-color: $navbar-background-color
2017-07-01 19:50:05 +00:00
box-shadow: 0 8px 16px rgba($black, 0.1)
2017-06-30 21:34:13 +00:00
padding: 0.5rem 0
2017-06-30 22:47:22 +00:00
&.is-active
display: block
2017-10-24 09:31:45 +00:00
// Fixed navbar
.navbar
&.is-fixed-bottom-touch,
&.is-fixed-top-touch
+navbar-fixed
&.is-fixed-bottom-touch
bottom: 0
2017-10-24 11:23:31 +00:00
&.has-shadow
box-shadow: 0 -2px 3px rgba($black, 0.1)
2017-10-24 09:31:45 +00:00
&.is-fixed-top-touch
top: 0
2017-10-26 18:47:48 +00:00
&.is-fixed-top,
&.is-fixed-top-touch
.navbar-menu
+overflow-touch
max-height: calc(100vh - #{$navbar-height})
overflow: auto
2017-10-24 09:31:45 +00:00
html.has-navbar-fixed-top-touch
padding-top: $navbar-height
html.has-navbar-fixed-bottom-touch
padding-bottom: $navbar-height
2017-06-30 21:34:13 +00:00
2017-06-30 22:16:22 +00:00
+desktop
2017-06-30 21:34:13 +00:00
.navbar,
.navbar-menu,
.navbar-start,
.navbar-end
align-items: stretch
display: flex
2017-06-30 22:16:22 +00:00
.navbar
2017-07-16 18:44:28 +00:00
min-height: $navbar-height
2017-07-01 17:30:39 +00:00
&.is-transparent
2017-07-02 21:07:30 +00:00
a.navbar-item,
2017-10-26 16:54:26 +00:00
a.navbar-link
2017-07-02 21:07:30 +00:00
&:hover,
&.is-active
2017-10-09 11:27:08 +00:00
background-color: transparent !important
2017-07-02 22:20:04 +00:00
.navbar-item.has-dropdown
2017-07-02 21:07:30 +00:00
&.is-active,
&.is-hoverable:hover
.navbar-link
2017-10-09 11:27:08 +00:00
background-color: transparent !important
2017-07-02 22:20:04 +00:00
.navbar-dropdown
a.navbar-item
&:hover
2017-07-28 20:05:15 +00:00
background-color: $navbar-dropdown-item-hover-background-color
color: $navbar-dropdown-item-hover-color
2017-07-02 22:20:04 +00:00
&.is-active
2017-07-28 20:05:15 +00:00
background-color: $navbar-dropdown-item-active-background-color
color: $navbar-dropdown-item-active-color
2017-06-30 21:34:13 +00:00
.navbar-burger
display: none
2017-06-30 22:16:22 +00:00
.navbar-item,
.navbar-link
align-items: center
display: flex
.navbar-item
&.has-dropdown
align-items: stretch
2017-10-24 11:23:31 +00:00
&.has-dropdown-up
.navbar-link::after
transform: rotate(135deg) translate(0.25em, -0.25em)
.navbar-dropdown
border-bottom: $navbar-dropdown-border-top
border-radius: $navbar-dropdown-radius $navbar-dropdown-radius 0 0
border-top: none
bottom: 100%
box-shadow: 0 -8px 8px rgba($black, 0.1)
top: auto
2017-06-30 22:47:22 +00:00
&.is-active,
&.is-hoverable:hover
2017-07-02 21:07:30 +00:00
.navbar-dropdown
display: block
&.is-boxed
opacity: 1
pointer-events: auto
transform: translateY(0)
.navbar-link
&::after
+arrow($navbar-dropdown-arrow)
margin-top: -0.375em
right: 1.125em
top: 50%
2017-06-30 21:34:13 +00:00
.navbar-menu
flex-grow: 1
flex-shrink: 0
.navbar-start
justify-content: flex-start
margin-right: auto
.navbar-end
justify-content: flex-end
2017-06-30 22:16:22 +00:00
margin-left: auto
.navbar-dropdown
2017-07-28 20:05:15 +00:00
background-color: $navbar-dropdown-background-color
2017-07-01 17:30:39 +00:00
border-bottom-left-radius: $navbar-dropdown-radius
border-bottom-right-radius: $navbar-dropdown-radius
2017-07-28 20:05:15 +00:00
border-top: $navbar-dropdown-border-top
2017-07-01 17:30:39 +00:00
box-shadow: 0 8px 8px rgba($black, 0.1)
2017-06-30 22:16:22 +00:00
display: none
font-size: 0.875rem
left: 0
min-width: 100%
position: absolute
2017-07-01 17:30:39 +00:00
top: 100%
2017-07-02 15:52:20 +00:00
z-index: $navbar-dropdown-z
2017-06-30 22:16:22 +00:00
.navbar-item
padding: 0.375rem 1rem
white-space: nowrap
2017-07-02 15:52:20 +00:00
a.navbar-item
padding-right: 3rem
2017-07-02 22:20:04 +00:00
&:hover
2017-07-28 20:05:15 +00:00
background-color: $navbar-dropdown-item-hover-background-color
color: $navbar-dropdown-item-hover-color
2017-07-02 22:20:04 +00:00
&.is-active
2017-07-28 20:05:15 +00:00
background-color: $navbar-dropdown-item-active-background-color
color: $navbar-dropdown-item-active-color
2017-07-01 17:30:39 +00:00
&.is-boxed
2017-07-28 20:05:15 +00:00
border-radius: $navbar-dropdown-boxed-radius
2017-07-01 17:30:39 +00:00
border-top: none
2017-07-28 20:05:15 +00:00
box-shadow: $navbar-dropdown-boxed-shadow
2017-07-01 17:30:39 +00:00
display: block
opacity: 0
pointer-events: none
top: calc(100% + (#{$navbar-dropdown-offset}))
transform: translateY(-5px)
transition-duration: $speed
transition-property: opacity, transform
2017-08-02 22:52:36 +00:00
&.is-right
left: auto
right: 0
2017-06-30 22:16:22 +00:00
.navbar-divider
display: block
2017-10-24 09:31:45 +00:00
.navbar > .container,
2017-06-30 22:16:22 +00:00
.container > .navbar
2017-09-05 13:09:31 +00:00
.navbar-brand
margin-left: -1rem
.navbar-menu
margin-right: -1rem
2017-10-24 09:31:45 +00:00
// Fixed navbar
.navbar
&.is-fixed-bottom-desktop,
&.is-fixed-top-desktop
+navbar-fixed
&.is-fixed-bottom-desktop
bottom: 0
2017-10-24 11:23:31 +00:00
&.has-shadow
box-shadow: 0 -2px 3px rgba($black, 0.1)
2017-10-24 09:31:45 +00:00
&.is-fixed-top-desktop
top: 0
html.has-navbar-fixed-top-desktop
padding-top: $navbar-height
html.has-navbar-fixed-bottom-desktop
padding-bottom: $navbar-height
2017-07-02 22:39:08 +00:00
// Hover/Active states
a.navbar-item,
2017-10-26 16:54:26 +00:00
a.navbar-link
2017-07-02 22:39:08 +00:00
&.is-active
2017-07-28 20:05:15 +00:00
color: $navbar-item-active-color
2017-07-02 22:39:08 +00:00
&.is-active:not(:hover)
2017-07-28 20:05:15 +00:00
background-color: $navbar-item-active-background-color
2017-07-02 22:39:08 +00:00
.navbar-item.has-dropdown
&:hover,
&.is-active
.navbar-link
2017-07-28 20:05:15 +00:00
background-color: $navbar-item-hover-background-color