// Core Button Variables // -------------------------------------------------- $button-font-size: 1.4rem !default; $button-margin: 0.4rem 0 !default; $button-padding: 0 1.4rem !default; $button-height: 4.2rem !default; $button-border-width: 1px !default; $button-border-radius: 4px !default; $button-icon-size: 2.5rem !default; $button-large-font-size: 2rem !default; $button-large-height: 5.4rem !default; $button-large-padding: 1.4rem !default; $button-large-icon-size: 3.6rem !default; $button-small-font-size: 1.3rem !default; $button-small-height: 2.8rem !default; $button-small-padding: 1.1rem !default; $button-small-icon-size: 2.1rem !default; // Core Button // -------------------------------------------------- button, [button] { display: inline-flex; flex-shrink: 0; flex-flow: row nowrap; align-items: center; justify-content: center; margin: $button-margin; line-height: 1; @include appearance(none); vertical-align: top; // the better option for most scenarios vertical-align: -webkit-baseline-middle; // the best for those that support it font-family: inherit; font-variant: inherit; font-style: inherit; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; cursor: pointer; user-select: none; border: 1px solid #ccc; padding: $button-padding; min-height: $button-height; // Default button has no background background: transparent; text-align: center; font-size: $button-font-size; border: transparent; border-radius: $button-border-radius; &[icon] { font-size: $button-icon-size; background: none; border: none; } &[large] { padding: 0 $button-large-padding; min-width: ($button-large-padding * 4); min-height: $button-large-height; font-size: $button-large-font-size; &[icon] { font-size: $button-large-icon-size; } } &[small] { padding: 0 $button-small-padding; min-width: ($button-small-padding * 3); min-height: $button-small-height; font-size: $button-small-font-size; &[icon] { font-size: $button-small-icon-size; } } // Core Button Types // -------------------------------------------------- &[clear] { border-color: transparent; background: none; &.activated { opacity: 0.3; } } &[outline] { background: none; } &[block] { display: flex; clear: both; margin-right: 0; margin-left: 0; width: 100%; &:after { clear: both; } } &.disabled, &[disabled] { opacity: .4; cursor: default !important; pointer-events: none; } } [full], [full] > button, [full] > [button] { display: flex; margin-right: 0; margin-left: 0; width: 100%; border-radius: 0; &[outline][outline] { border-right-width: 0; border-left-width: 0; } } .padding > button[block]:first-child, .padding > [button][block]:first-child { margin-top: 0; } .icon-left:before { font-size: 1.5em; margin-top: -0.1em; margin-right: 0.25em; } .icon-right:before { order: 2; font-size: 1.5em; margin-top: -0.1em; margin-left: 0.25em; } // Button Misc // -------------------------------------------------- a[button] { color: inherit; text-decoration: none; } // Core Button Mixins // -------------------------------------------------- @mixin button-default($bg-color, $fg-color) { background-color: $bg-color; color: $fg-color; &:hover, &.hover { opacity: 0.88; color: $fg-color; text-decoration: none; } &:active, &.activated { opacity: 1; background-color: darken($bg-color, 12%); } } @mixin button-clear($fg-color) { &[clear] { background: none; color: $fg-color; } } @mixin button-outline($fg-color) { &[outline] { border: 1px solid $fg-color; background: transparent; color: $fg-color; &.activated { background-color: rgba(red($fg-color), green($fg-color), blue($fg-color), 0.15); } } } // Core Button Color Generation // -------------------------------------------------- @each $color, $value in $colors { button[#{$color}], [button][#{$color}] { @include button-default(get-color($color, base), get-color($color, inverse)); @include button-clear(get-color($color, base)); @include button-outline(get-color($color, base)); } }