KNACSS/sass/components/buttons.scss

96 lines
1.8 KiB
SCSS
Raw Normal View History

2017-07-31 13:24:04 +02:00
/* ----------------------------- */
/* ==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;
2017-07-31 15:49:38 +02:00
transition: 0.25s;
2017-07-31 13:24:04 +02:00
transition-property: box-shadow, background-color, color, border;
2017-07-31 15:49:38 +02:00
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;
2017-07-31 13:24:04 +02:00
}
.btn,
.button,
[type="button"],
button {
@extend %btn;
&:focus {
-webkit-tap-highlight-color: transparent;
}
}
2017-07-31 14:00:06 +02:00
2017-07-31 13:24:04 +02:00
.btn,
.button {
2017-07-31 15:49:38 +02:00
@each $name, $background-color, $color, $border in $variants-list {
2017-07-31 14:00:06 +02:00
&--#{$name} {
2017-07-31 13:24:04 +02:00
@extend %btn;
2017-07-31 14:00:06 +02:00
background-color: $background-color;
color: $color;
box-shadow: $border;
2017-07-31 13:24:04 +02:00
&:active,
&:focus,
&:hover {
2017-07-31 14:00:06 +02:00
background-color: darken( $background-color, 10% );
2017-07-31 13:24:04 +02:00
}
}
}
}
2017-07-31 14:00:06 +02:00
2017-07-31 13:24:04 +02:00
// 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,
2017-07-31 15:49:38 +02:00
&--disabled {
2017-07-31 13:24:04 +02:00
opacity: 0.5;
cursor: not-allowed;
}
2017-07-31 15:49:38 +02:00
&--unstyled {
2017-07-31 13:24:04 +02:00
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;
}
}
}