2019-06-18 14:53:24 +08:00
|
|
|
@import './mixins/mixins.scss';
|
2019-09-17 19:28:07 +08:00
|
|
|
@import './themes/vars.scss';
|
2019-06-18 14:53:24 +08:00
|
|
|
|
2019-09-16 17:52:31 +08:00
|
|
|
@mixin size-mixin($size) {
|
|
|
|
@include m($size + "-size") {
|
|
|
|
$height: map-get($map: $button-height, $key: $size);
|
|
|
|
$font-size: map-get($map: $button-font-size, $key: $size);
|
|
|
|
font-size: $font-size;
|
|
|
|
height: $height;
|
|
|
|
padding: map-get($map: $button-padding, $key: $size);
|
|
|
|
@include m(round) {
|
|
|
|
padding: map-get($map: $round-button-padding, $key: $size);
|
|
|
|
border-radius: $height / 2;
|
|
|
|
}
|
|
|
|
@include e(content) {
|
|
|
|
line-height: $height;
|
|
|
|
}
|
|
|
|
@include e(icon) {
|
|
|
|
$icon-size: map-get($map: $button-icon-size, $key: $size);
|
|
|
|
height: $icon-size;
|
|
|
|
width: $icon-size;
|
|
|
|
max-width: $icon-size;
|
|
|
|
.n-icon {
|
|
|
|
font-size: $icon-size;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
@include m(slot) {
|
|
|
|
height: $icon-size;
|
|
|
|
width: $icon-size;
|
|
|
|
line-height: $icon-size;
|
|
|
|
.n-icon-slot {
|
|
|
|
height: $icon-size;
|
|
|
|
width: $icon-size;
|
|
|
|
font-size: $icon-size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin type-mixin ($type) {
|
|
|
|
@include m($type + "-type") {
|
2019-09-17 00:57:51 +08:00
|
|
|
border-radius: $button-border-radius;
|
2019-09-16 17:52:31 +08:00
|
|
|
color: map-get($map: $button-color, $key: $type);
|
|
|
|
background-color: map-get($map: $button-background-color, $key: $type);
|
|
|
|
box-shadow: map-get($map: $button-box-shadow, $key: $type);
|
|
|
|
@include not-m(disabled) {
|
2019-09-17 00:57:51 +08:00
|
|
|
@include m(enter-pressed) {
|
|
|
|
background-color: map-get($map: $button-background-color, $key: $type + '-active');
|
|
|
|
}
|
2019-09-16 17:52:31 +08:00
|
|
|
@include m(rippling) {
|
2019-09-17 00:57:51 +08:00
|
|
|
&::after {
|
2019-09-17 19:28:07 +08:00
|
|
|
animation-name: #{$theme}-#{$type}-button-ripple--spread, #{$theme}-#{$type}-button-ripple--opacity;
|
2019-09-17 00:57:51 +08:00
|
|
|
animation-duration: .6s;
|
|
|
|
animation-timing-function: cubic-bezier(0, .4, .5, .9), cubic-bezier(.5, .2, .8, .5);
|
|
|
|
}
|
2019-09-16 17:52:31 +08:00
|
|
|
}
|
|
|
|
&:not(:active):focus {
|
|
|
|
@include not-m(enter-pressed) {
|
2019-09-17 00:57:51 +08:00
|
|
|
background-color: map-get($map: $button-background-color, $key: $type + '-hover');
|
2019-09-16 17:52:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
&:hover {
|
|
|
|
background-color: map-get($map: $button-background-color, $key: $type + '-hover');
|
|
|
|
}
|
|
|
|
&:active {
|
|
|
|
background-color: map-get($map: $button-background-color, $key: $type + '-active');
|
|
|
|
}
|
|
|
|
}
|
2019-09-17 19:28:07 +08:00
|
|
|
@content;
|
2019-09-16 17:52:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin ripple-mixin($type) {
|
2019-09-17 19:28:07 +08:00
|
|
|
@keyframes #{$theme}-#{$type}-button-ripple--spread {
|
2019-09-16 17:52:31 +08:00
|
|
|
from {
|
|
|
|
box-shadow: map-get($map: $button-box-shadow, $key: $type + '-focus-ripple-start');
|
|
|
|
}
|
|
|
|
to {
|
2019-09-17 00:57:51 +08:00
|
|
|
box-shadow: map-get($map: $button-box-shadow, $key: $type + '-focus-ripple-end');
|
|
|
|
}
|
|
|
|
}
|
2019-09-17 19:28:07 +08:00
|
|
|
@keyframes #{$theme}-#{$type}-button-ripple--opacity {
|
2019-09-17 00:57:51 +08:00
|
|
|
from {
|
|
|
|
opacity: .4;
|
|
|
|
}
|
|
|
|
to {
|
|
|
|
opacity: 0;
|
2019-09-16 17:52:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-17 19:28:07 +08:00
|
|
|
@include themes-mixin() {
|
|
|
|
@include ripple-mixin('default');
|
|
|
|
@include ripple-mixin('primary');
|
|
|
|
@include b(button) {
|
|
|
|
@include once {
|
|
|
|
outline: none;
|
|
|
|
position: relative;
|
|
|
|
border: none;
|
|
|
|
font-family: $button-font-family;
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
user-select: none;
|
|
|
|
font-weight: 700;
|
|
|
|
text-align: center;
|
|
|
|
vertical-align: baseline;
|
|
|
|
transition: background-color .3s $default-cubic-bezier, opacity .15s $default-cubic-bezier, box-shadow .3s $default-cubic-bezier;
|
|
|
|
cursor: pointer;
|
|
|
|
&::after {
|
|
|
|
content: "";
|
|
|
|
border-radius: inherit;
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
|
|
|
@include e(icon) {
|
|
|
|
@include fade-in-width-expand-transition();
|
|
|
|
margin-right: 6px;
|
|
|
|
@include m(right) {
|
|
|
|
margin-right: 0px;
|
|
|
|
margin-left: 4px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@include e(content) {
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
@include m(block) {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
@include m(disabled) {
|
|
|
|
cursor: not-allowed;
|
|
|
|
opacity: .4;
|
|
|
|
}
|
|
|
|
@include m(loading) {
|
|
|
|
cursor: default;
|
|
|
|
opacity: .6;
|
|
|
|
}
|
|
|
|
&::-moz-focus-inner {
|
|
|
|
border: 0;
|
|
|
|
}
|
|
|
|
@include size-mixin('tiny');
|
|
|
|
@include size-mixin('small');
|
|
|
|
@include size-mixin('medium');
|
|
|
|
@include size-mixin('large');
|
2019-07-04 10:41:59 +08:00
|
|
|
}
|
2019-09-17 19:28:07 +08:00
|
|
|
@include type-mixin('default');
|
|
|
|
@include type-mixin('primary');
|
2019-06-18 14:53:24 +08:00
|
|
|
}
|
|
|
|
}
|