KNACSS/sass/components/buttons.scss
2017-07-31 20:47:46 +02:00

95 lines
1.8 KiB
SCSS

/* ----------------------------- */
/* ==Buttons */
/* ----------------------------- */
/* preferably use <button> for buttons !*/
/* use .btn-- or .button-- classes for variants */
%btn {
display: inline-block;
padding: $tiny-value $small-value;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
transition: 0.25s;
transition-property: box-shadow, background-color, color, border;
text-align: center;
vertical-align: middle;
white-space: nowrap;
text-decoration: none;
color: $color-base;
border: none;
border-radius: $border-radius;
background-color: $color-muted;
font-family: inherit;
font-size: inherit;
line-height: 1;
}
.btn,
.button,
[type="button"],
button {
@extend %btn;
&:focus {
-webkit-tap-highlight-color: transparent;
}
}
.btn,
.button {
@each $name, $background-color, $color, $border in $variants-list {
&--#{$name} {
@extend %btn;
background-color: $background-color;
color: $color;
box-shadow: $border;
&:active,
&:focus,
&:hover {
background-color: darken( $background-color, 10% );
}
}
}
}
// button state variants
.btn,
.button {
&--small {
font-size: $base-font-size - 0.4rem;
}
&--big {
font-size: $base-font-size + 0.4rem;
}
&--block {
width: 100% !important;
display: block;
}
&.disabled,
&--disabled {
opacity: 0.5;
cursor: not-allowed;
}
&--unstyled {
padding: 0;
border: none;
text-align: left;
background: none;
border-radius: 0;
box-shadow: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
&:focus {
box-shadow: none;
outline: none;
}
}
}