You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
3.1 KiB

8 years ago
// Button variants
//
// Easily pump out default styles, as well as :hover, :focus, :active,
// and disabled options for all buttons
8 years ago
@mixin button-variant($background, $border, $hover-background: darken($background, 7.5%), $hover-border: darken($border, 10%), $active-background: darken($background, 10%), $active-border: darken($border, 12.5%)) {
color: color-yiq($background);
@include gradient-bg($background);
8 years ago
border-color: $border;
@include box-shadow($btn-box-shadow);
@include hover {
8 years ago
color: color-yiq($hover-background);
@include gradient-bg($hover-background);
border-color: $hover-border;
8 years ago
}
8 years ago
8 years ago
&:focus,
&.focus {
// Avoid using mixin so we can pass custom focus shadow properly
@if $enable-shadows {
8 years ago
box-shadow: $btn-box-shadow, 0 0 0 $btn-focus-width rgba($border, .5);
8 years ago
} @else {
8 years ago
box-shadow: 0 0 0 $btn-focus-width rgba($border, .5);
8 years ago
}
}
// Disabled comes first so active can properly restyle
&.disabled,
&:disabled {
8 years ago
color: color-yiq($background);
8 years ago
background-color: $background;
border-color: $border;
}
8 years ago
&:not(:disabled):not(.disabled):active,
&:not(:disabled):not(.disabled).active,
8 years ago
.show > &.dropdown-toggle {
8 years ago
color: color-yiq($active-background);
8 years ago
background-color: $active-background;
8 years ago
@if $enable-gradients {
background-image: none; // Remove the gradient for the pressed/active state
}
8 years ago
border-color: $active-border;
8 years ago
&:focus {
// Avoid using mixin so we can pass custom focus shadow properly
@if $enable-shadows {
box-shadow: $btn-active-box-shadow, 0 0 0 $btn-focus-width rgba($border, .5);
} @else {
box-shadow: 0 0 0 $btn-focus-width rgba($border, .5);
}
}
8 years ago
}
}
8 years ago
@mixin button-outline-variant($color, $color-hover: color-yiq($color), $active-background: $color, $active-border: $color) {
8 years ago
color: $color;
background-color: transparent;
8 years ago
background-image: none;
8 years ago
border-color: $color;
8 years ago
&:hover {
8 years ago
color: $color-hover;
8 years ago
background-color: $active-background;
border-color: $active-border;
8 years ago
}
&:focus,
&.focus {
8 years ago
box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
8 years ago
}
&.disabled,
&:disabled {
color: $color;
background-color: transparent;
}
8 years ago
&:not(:disabled):not(.disabled):active,
&:not(:disabled):not(.disabled).active,
8 years ago
.show > &.dropdown-toggle {
8 years ago
color: color-yiq($active-background);
background-color: $active-background;
border-color: $active-border;
&:focus {
// Avoid using mixin so we can pass custom focus shadow properly
@if $enable-shadows and $btn-active-box-shadow != none {
box-shadow: $btn-active-box-shadow, 0 0 0 $btn-focus-width rgba($color, .5);
} @else {
box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
}
}
8 years ago
}
}
// Button sizes
8 years ago
@mixin button-size($padding-y, $padding-x, $font-size, $line-height, $border-radius) {
8 years ago
padding: $padding-y $padding-x;
font-size: $font-size;
8 years ago
line-height: $line-height;
// Manually declare to provide an override to the browser default
@if $enable-rounded {
border-radius: $border-radius;
} @else {
border-radius: 0;
}
8 years ago
}