mdb-ui-kit/scss/mixins/_buttons.scss

176 lines
3.9 KiB
SCSS
Raw Normal View History

// from bs mixins/buttons button-variant
@mixin bmd-button-variant($color, $background, $focus-background, $active-background, $border, $focus-border, $active-border) {
color: $color;
background-color: $background;
border-color: $border;
@include hover {
color: $color;
background-color: $focus-background;
border-color: $focus-border;
}
&:focus,
&.focus {
color: $color;
background-color: $focus-background;
border-color: $focus-border;
}
&:active,
&.active,
.open > &.dropdown-toggle {
color: $color;
background-color: $focus-background;
border-color: $focus-border;
&:hover,
&:focus,
&.focus {
color: $color;
background-color: $active-background;
border-color: $active-border;
}
}
// when it is an icon, kill the active bg on open dropdown, but stabilize on hover
.open > &.dropdown-toggle.bmd-btn-icon {
color: inherit;
background-color: $background;
// leave hover on with the lighter focus color
&:hover {
background-color: $focus-background;
}
}
&.disabled,
&:disabled {
&:focus,
&.focus {
background-color: $background;
border-color: $border;
}
@include hover {
background-color: $background;
border-color: $border;
}
}
}
2016-08-03 19:49:32 +03:00
@mixin bmd-flat-button-variant(
$color,
$border: $bmd-btn-border,
$focus-border: $bmd-btn-focus-bg,
$active-border: $bmd-btn-active-bg
) {
$background: $bmd-btn-bg;
$focus-background: $bmd-btn-focus-bg;
$active-background: $bmd-btn-active-bg;
@include bmd-button-variant($color,
$background,
$focus-background,
$active-background,
$border,
$focus-border,
$active-border);
// inverse color scheme
.bg-inverse & {
$focus-background: $bmd-inverse-btn-focus-bg;
$focus-border: $bmd-inverse-btn-focus-bg;
$active-background: $bmd-inverse-btn-active-bg;
$active-border: $bmd-inverse-btn-active-bg;
@include bmd-button-variant($color,
$background,
$focus-background,
$active-background,
$border,
$focus-border,
$active-border);
}
// reverse the above for links
&.btn-link {
background-color: transparent;
}
}
@mixin bmd-flat-button-color() {
@include bmd-flat-button-variant($bmd-btn-color);
// flat bg with text color variations
@each $color, $value in $theme-colors {
&.btn-#{$color} {
@include bmd-flat-button-variant($value);
}
}
}
@mixin bmd-outline-border() {
border-color: currentColor;
border-style: solid;
border-width: 1px;
}
2016-08-03 19:49:32 +03:00
@mixin bmd-outline-button-color() {
&.btn-outline {
@include bmd-outline-border();
2016-08-03 19:49:32 +03:00
}
// flat bg with text and border color variations
@each $color, $value in $theme-colors {
&.btn-outline-#{$color} {
@include bmd-outline-border();
@include bmd-flat-button-variant($value, $value, $value, $value);
}
2016-08-03 19:49:32 +03:00
}
}
@mixin bmd-raised-button-variant($color, $background, $border) {
// FIXME: SPEC - this should be the 600 color, how can we get that programmatically if at all? Or are we limited to the color palette only?
2017-08-11 17:59:31 +03:00
$focus-background: contrast-color(
$background,
darken($background, 4%),
lighten($background, 4%)
2017-08-11 17:59:31 +03:00
);
//$focus-background: darken($background, 10%); // default bootstrap
$focus-border: darken($border, 12%);
$active-background: $focus-background;
//$active-background: darken($background, 17%);
$active-border: darken($border, 25%);
@include bmd-button-variant($color,
$background,
$focus-background,
$active-background,
$border,
$focus-border,
$active-border);
}
@mixin bmd-raised-button-color() {
@each $color, $value in $theme-colors {
&.btn-#{$color} {
@include bmd-raised-button-variant(#fff, $value, $value);
}
}
}
@mixin undo-bs-tab-focus() {
// clear out the tab-focus() from BS
&,
&:active,
&.active {
&:focus,
&.focus {
//@include tab-focus();
outline: 0;
}
}
}