cycat-project-website/_sass/bootstrap/_buttons.scss

140 lines
2.6 KiB
SCSS
Raw Permalink Normal View History

2018-12-09 08:21:01 +01:00
// stylelint-disable selector-no-qualifying-type
//
// Base styles
//
.btn {
display: inline-block;
2020-08-23 12:01:06 +02:00
font-family: $btn-font-family;
2018-12-09 08:21:01 +01:00
font-weight: $btn-font-weight;
2020-08-23 12:01:06 +02:00
color: $body-color;
2018-12-09 08:21:01 +01:00
text-align: center;
2020-08-23 12:01:06 +02:00
white-space: $btn-white-space;
2018-12-09 08:21:01 +01:00
vertical-align: middle;
2020-08-23 12:01:06 +02:00
cursor: if($enable-pointer-cursor-for-buttons, pointer, null);
2018-12-09 08:21:01 +01:00
user-select: none;
2020-08-23 12:01:06 +02:00
background-color: transparent;
2018-12-09 08:21:01 +01:00
border: $btn-border-width solid transparent;
2020-08-23 12:01:06 +02:00
@include button-size($btn-padding-y, $btn-padding-x, $btn-font-size, $btn-line-height, $btn-border-radius);
2018-12-09 08:21:01 +01:00
@include transition($btn-transition);
2020-08-23 12:01:06 +02:00
@include hover() {
color: $body-color;
2018-12-09 08:21:01 +01:00
text-decoration: none;
}
&:focus,
&.focus {
outline: 0;
box-shadow: $btn-focus-box-shadow;
}
// Disabled comes first so active can properly restyle
&.disabled,
&:disabled {
opacity: $btn-disabled-opacity;
@include box-shadow(none);
}
&:not(:disabled):not(.disabled):active,
&:not(:disabled):not(.disabled).active {
@include box-shadow($btn-active-box-shadow);
&:focus {
@include box-shadow($btn-focus-box-shadow, $btn-active-box-shadow);
}
}
}
// Future-proof disabling of clicks on `<a>` elements
a.btn.disabled,
fieldset:disabled a.btn {
pointer-events: none;
}
//
// Alternate buttons
//
@each $color, $value in $theme-colors {
.btn-#{$color} {
@include button-variant($value, $value);
}
}
@each $color, $value in $theme-colors {
.btn-outline-#{$color} {
@include button-outline-variant($value);
}
}
//
// Link buttons
//
// Make a button look and behave like a link
.btn-link {
font-weight: $font-weight-normal;
color: $link-color;
2020-08-23 12:01:06 +02:00
text-decoration: $link-decoration;
2018-12-09 08:21:01 +01:00
2020-08-23 12:01:06 +02:00
@include hover() {
2018-12-09 08:21:01 +01:00
color: $link-hover-color;
text-decoration: $link-hover-decoration;
}
&:focus,
&.focus {
text-decoration: $link-hover-decoration;
box-shadow: none;
}
&:disabled,
&.disabled {
color: $btn-link-disabled-color;
2020-08-23 12:01:06 +02:00
pointer-events: none;
2018-12-09 08:21:01 +01:00
}
// No need for an active state here
}
//
// Button Sizes
//
.btn-lg {
2020-08-23 12:01:06 +02:00
@include button-size($btn-padding-y-lg, $btn-padding-x-lg, $btn-font-size-lg, $btn-line-height-lg, $btn-border-radius-lg);
2018-12-09 08:21:01 +01:00
}
.btn-sm {
2020-08-23 12:01:06 +02:00
@include button-size($btn-padding-y-sm, $btn-padding-x-sm, $btn-font-size-sm, $btn-line-height-sm, $btn-border-radius-sm);
2018-12-09 08:21:01 +01:00
}
//
// Block button
//
.btn-block {
display: block;
width: 100%;
// Vertically space out multiple block buttons
+ .btn-block {
margin-top: $btn-block-spacing-y;
}
}
// Specificity overrides
input[type="submit"],
input[type="reset"],
input[type="button"] {
&.btn-block {
width: 100%;
}
}