2016-12-22 18:17:26 +00:00
|
|
|
$button: $grey-darker !default
|
|
|
|
$button-background: $white !default
|
|
|
|
$button-border: $grey-lighter !default
|
2016-10-30 10:41:53 +00:00
|
|
|
|
2016-10-29 20:51:13 +00:00
|
|
|
$button-hover: $link-hover !default
|
|
|
|
$button-hover-border: $link-hover-border !default
|
|
|
|
|
|
|
|
$button-focus: $link-focus !default
|
|
|
|
$button-focus-border: $link-focus-border !default
|
|
|
|
|
|
|
|
$button-active: $link-active !default
|
|
|
|
$button-active-border: $link-active-border !default
|
|
|
|
|
|
|
|
$button-shadow-inset: inset 0 1px 2px rgba($black, 0.2)
|
|
|
|
|
2016-12-22 18:17:26 +00:00
|
|
|
@function buttonIconSpacing($button-font-size, $icon-width)
|
2016-10-30 10:41:53 +00:00
|
|
|
// The rem height of the button
|
2016-12-22 18:17:26 +00:00
|
|
|
// based on a height of 2.5em
|
|
|
|
$button-height: 2.5 * $button-font-size // rem
|
|
|
|
// The rem total horizontal padding of the button
|
|
|
|
$button-horizontal-padding: 2 * 0.75 * $button-font-size // rem
|
|
|
|
// For the icon center to align with the button center
|
|
|
|
// the horizontal padding + the icon width must equal the button height
|
|
|
|
// $button-height = $button-horizontal-padding + $icon-width + $difference
|
|
|
|
$difference: $button-height - $button-horizontal-padding - $icon-width
|
|
|
|
@return $difference / 2
|
2016-10-30 10:41:53 +00:00
|
|
|
|
2016-12-22 18:17:26 +00:00
|
|
|
=button-icon($button-font-size)
|
|
|
|
$small-offset: buttonIconSpacing($button-font-size, 1rem)
|
|
|
|
$normal-offset: buttonIconSpacing($button-font-size, 1.5rem)
|
|
|
|
$medium-offset: buttonIconSpacing($button-font-size, 2rem)
|
|
|
|
$large-offset: buttonIconSpacing($button-font-size, 3rem)
|
2016-10-30 10:41:53 +00:00
|
|
|
.icon
|
2016-10-30 20:02:48 +00:00
|
|
|
&:first-child:not(:last-child)
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-left: $normal-offset
|
|
|
|
margin-right: $button-font-size / 2
|
2016-10-30 20:02:48 +00:00
|
|
|
&:last-child:not(:first-child)
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-left: $button-font-size / 2
|
|
|
|
margin-right: $normal-offset
|
2016-10-30 20:02:48 +00:00
|
|
|
&:first-child:last-child
|
2016-12-22 18:17:26 +00:00
|
|
|
// The -1px is to account for the button 1px border
|
|
|
|
margin-left: calc(-1px + #{$normal-offset})
|
|
|
|
margin-right: calc(-1px + #{$normal-offset})
|
2016-10-30 10:41:53 +00:00
|
|
|
&.is-small
|
2016-10-30 20:02:48 +00:00
|
|
|
&:first-child:not(:last-child)
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-left: $small-offset
|
2016-10-30 20:02:48 +00:00
|
|
|
&:last-child:not(:first-child)
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-right: $small-offset
|
2016-10-30 20:02:48 +00:00
|
|
|
&:first-child:last-child
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-left: calc(-1px + #{$small-offset})
|
|
|
|
margin-right: calc(-1px + #{$small-offset})
|
2016-10-30 10:41:53 +00:00
|
|
|
&.is-medium
|
2016-10-30 20:02:48 +00:00
|
|
|
&:first-child:not(:last-child)
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-left: $medium-offset
|
2016-10-30 20:02:48 +00:00
|
|
|
&:last-child:not(:first-child)
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-right: $medium-offset
|
2016-10-30 20:02:48 +00:00
|
|
|
&:first-child:last-child
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-left: calc(-1px + #{$medium-offset})
|
|
|
|
margin-right: calc(-1px + #{$medium-offset})
|
2016-10-30 10:41:53 +00:00
|
|
|
&.is-large
|
2016-10-30 20:02:48 +00:00
|
|
|
&:first-child:not(:last-child)
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-left: $large-offset
|
2016-10-30 20:02:48 +00:00
|
|
|
&:last-child:not(:first-child)
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-right: $large-offset
|
2016-10-30 20:02:48 +00:00
|
|
|
&:first-child:last-child
|
2016-12-22 18:17:26 +00:00
|
|
|
margin-left: calc(-1px + #{$large-offset})
|
|
|
|
margin-right: calc(-1px + #{$large-offset})
|
2016-10-30 10:41:53 +00:00
|
|
|
|
|
|
|
// The button sizes use mixins so they can be used at different breakpoints
|
2016-01-24 00:03:43 +00:00
|
|
|
=button-small
|
2016-06-29 22:25:27 +00:00
|
|
|
border-radius: $radius-small
|
2016-10-29 17:53:30 +00:00
|
|
|
font-size: $size-small
|
2016-10-30 10:41:53 +00:00
|
|
|
+button-icon($size-small)
|
2016-01-24 00:03:43 +00:00
|
|
|
=button-medium
|
2016-10-29 17:53:30 +00:00
|
|
|
font-size: $size-medium
|
2016-10-30 10:41:53 +00:00
|
|
|
+button-icon($size-medium)
|
2016-01-24 00:03:43 +00:00
|
|
|
=button-large
|
2016-10-29 17:53:30 +00:00
|
|
|
font-size: $size-large
|
2016-10-30 10:41:53 +00:00
|
|
|
+button-icon($size-large)
|
2016-01-24 00:03:43 +00:00
|
|
|
|
|
|
|
.button
|
|
|
|
+control
|
2016-09-22 22:14:18 +00:00
|
|
|
+unselectable
|
2016-10-30 10:41:53 +00:00
|
|
|
background-color: $button-background
|
|
|
|
border: 1px solid $button-border
|
|
|
|
color: $button
|
2016-09-22 22:14:18 +00:00
|
|
|
cursor: pointer
|
2016-03-26 17:28:43 +00:00
|
|
|
justify-content: center
|
2016-12-22 18:17:26 +00:00
|
|
|
padding-left: 0.75em
|
|
|
|
padding-right: 0.75em
|
2016-01-30 11:53:41 +00:00
|
|
|
text-align: center
|
2016-01-26 00:02:38 +00:00
|
|
|
white-space: nowrap
|
2016-01-24 00:03:43 +00:00
|
|
|
strong
|
|
|
|
color: inherit
|
2016-10-30 10:41:53 +00:00
|
|
|
+button-icon($size-normal)
|
2016-10-29 20:51:13 +00:00
|
|
|
// States
|
2016-05-30 18:41:54 +00:00
|
|
|
&:hover,
|
2016-10-29 20:51:13 +00:00
|
|
|
&.is-hovered
|
|
|
|
border-color: $button-hover-border
|
|
|
|
color: $button-hover
|
2016-05-30 18:41:54 +00:00
|
|
|
&:focus,
|
2016-10-29 20:51:13 +00:00
|
|
|
&.is-focused
|
|
|
|
border-color: $button-focus-border
|
2016-10-30 17:35:39 +00:00
|
|
|
box-shadow: 0 0 0.5em rgba($button-focus-border, 0.25)
|
2016-10-29 20:51:13 +00:00
|
|
|
color: $button-focus
|
|
|
|
&:active,
|
2016-05-30 18:41:54 +00:00
|
|
|
&.is-active
|
2016-10-29 20:51:13 +00:00
|
|
|
border-color: $button-active-border
|
|
|
|
box-shadow: $button-shadow-inset
|
|
|
|
color: $button-active
|
2016-04-10 15:00:32 +00:00
|
|
|
// Colors
|
2016-10-29 20:51:13 +00:00
|
|
|
&.is-link
|
|
|
|
background-color: transparent
|
2016-10-30 10:41:53 +00:00
|
|
|
border-color: transparent
|
2016-10-29 20:51:13 +00:00
|
|
|
color: $text
|
|
|
|
text-decoration: underline
|
|
|
|
&:hover,
|
|
|
|
&.is-hovered,
|
|
|
|
&:focus,
|
|
|
|
&.is-focused,
|
|
|
|
&:active,
|
|
|
|
&.is-active
|
|
|
|
background-color: $background
|
|
|
|
color: $text-strong
|
2016-01-24 00:03:43 +00:00
|
|
|
@each $name, $pair in $colors
|
|
|
|
$color: nth($pair, 1)
|
|
|
|
$color-invert: nth($pair, 2)
|
|
|
|
&.is-#{$name}
|
2016-06-29 22:59:48 +00:00
|
|
|
background-color: $color
|
2016-10-30 10:41:53 +00:00
|
|
|
border-color: transparent
|
2016-01-24 00:03:43 +00:00
|
|
|
color: $color-invert
|
|
|
|
&:hover,
|
2016-10-29 20:51:13 +00:00
|
|
|
&.is-hovered
|
|
|
|
background-color: darken($color, 2.5%)
|
|
|
|
border-color: transparent
|
|
|
|
color: $color-invert
|
2016-05-30 18:41:54 +00:00
|
|
|
&:focus,
|
2016-10-29 20:51:13 +00:00
|
|
|
&.is-focused
|
|
|
|
border-color: transparent
|
2016-10-30 17:35:39 +00:00
|
|
|
box-shadow: 0 0 0.5em rgba($color, 0.25)
|
2016-10-29 20:51:13 +00:00
|
|
|
color: $color-invert
|
|
|
|
&:active,
|
2016-05-30 18:41:54 +00:00
|
|
|
&.is-active
|
2016-09-22 18:48:42 +00:00
|
|
|
background-color: darken($color, 5%)
|
2016-01-24 00:03:43 +00:00
|
|
|
border-color: transparent
|
2016-10-29 20:51:13 +00:00
|
|
|
box-shadow: $button-shadow-inset
|
2016-01-24 00:03:43 +00:00
|
|
|
color: $color-invert
|
|
|
|
&.is-inverted
|
2016-06-29 22:59:48 +00:00
|
|
|
background-color: $color-invert
|
2016-01-24 00:03:43 +00:00
|
|
|
color: $color
|
|
|
|
&:hover
|
2016-06-29 22:59:48 +00:00
|
|
|
background-color: darken($color-invert, 5%)
|
2016-04-10 15:00:32 +00:00
|
|
|
&.is-loading
|
|
|
|
&:after
|
|
|
|
border-color: transparent transparent $color-invert $color-invert !important
|
|
|
|
&.is-outlined
|
2016-06-29 22:59:48 +00:00
|
|
|
background-color: transparent
|
2016-04-10 15:00:32 +00:00
|
|
|
border-color: $color
|
|
|
|
color: $color
|
|
|
|
&:hover,
|
|
|
|
&:focus
|
2016-06-29 22:59:48 +00:00
|
|
|
background-color: $color
|
2016-05-05 23:23:00 +00:00
|
|
|
border-color: $color
|
|
|
|
color: $color-invert
|
2016-10-30 20:24:23 +00:00
|
|
|
&.is-inverted.is-outlined
|
|
|
|
background-color: transparent
|
|
|
|
border-color: $color-invert
|
|
|
|
color: $color-invert
|
|
|
|
&:hover,
|
|
|
|
&:focus
|
|
|
|
background-color: $color-invert
|
|
|
|
color: $color
|
2016-04-10 15:00:32 +00:00
|
|
|
// Sizes
|
2016-01-24 00:03:43 +00:00
|
|
|
&.is-small
|
|
|
|
+button-small
|
|
|
|
&.is-medium
|
|
|
|
+button-medium
|
|
|
|
&.is-large
|
|
|
|
+button-large
|
2016-04-10 15:00:32 +00:00
|
|
|
// Modifiers
|
|
|
|
&[disabled],
|
|
|
|
&.is-disabled
|
|
|
|
opacity: 0.5
|
2016-01-26 00:02:38 +00:00
|
|
|
&.is-fullwidth
|
2016-05-29 12:16:09 +00:00
|
|
|
display: flex
|
2016-01-26 00:02:38 +00:00
|
|
|
width: 100%
|
2016-01-24 00:03:43 +00:00
|
|
|
&.is-loading
|
2016-05-07 11:58:13 +00:00
|
|
|
color: transparent !important
|
2016-01-24 00:03:43 +00:00
|
|
|
pointer-events: none
|
|
|
|
&:after
|
2016-09-22 22:14:18 +00:00
|
|
|
+loader
|
2016-01-24 00:03:43 +00:00
|
|
|
+center(16px)
|
|
|
|
position: absolute !important
|