naive-ui/styles/Message.scss
2020-04-23 18:02:27 +08:00

134 lines
3.7 KiB
SCSS

@import './mixins/mixins.scss';
@mixin message-type-mixin ($type) {
@include m($type + '-type') {
color: map-get($--message-text-color, $type);
background-color: map-get($map: $--message-background-color, $key: $type);
box-shadow: map-get($map: $--message-box-shadow, $key: $type);
@include e(icon) {
@include b(icon) {
fill: $--message-icon-color;
stroke: $--message-icon-color;
}
}
@if $type == 'loading' {
@include e(close) {
@include b(icon) {
cursor: pointer;
fill: map-get($--message-loading-close-color, 'default');
stroke: map-get($--message-loading-close-color, 'default');
&:hover {
fill: map-get($--message-loading-close-color, 'hover');
stroke: map-get($--message-loading-close-color, 'hover');
}
&:active {
fill: map-get($--message-loading-close-color, 'active');
stroke: map-get($--message-loading-close-color, 'active');
}
}
}
}
}
}
@include b(message-container) {
@include once {
z-index: 6000;
position: fixed;
top: 12px;
left: 0;
right: 0;
height: 0;
overflow: visible;
display: flex;
flex-direction: column;
align-items: center;
}
}
@include themes-mixin {
@include b(message) {
@include once {
display: flex;
transition:
color .3s $--n-ease-in-out-cubic-bezier,
box-shadow .3s $--n-ease-in-out-cubic-bezier,
background-color .3s $--n-ease-in-out-cubic-bezier,
opacity .3s $--n-ease-in-out-cubic-bezier,
transform .3s $--n-ease-in-out-cubic-bezier,
max-height .3s $--n-ease-in-out-cubic-bezier,
margin-bottom .3s $--n-ease-in-out-cubic-bezier;
max-height: 40px;
opacity: 1;
margin-bottom: 12px;
padding: 0 40px;
height: 40px;
border-radius: 20px;
flex-shrink: 0;
font-weight: 400;
overflow: hidden;
&#{&}-transition-enter, &#{&}-transition-leave-to {
opacity: 0;
transform: translateY(-12px) scale(.5);
transform-origin: top center;
max-height: 0;
margin-bottom: 0;
}
}
@include once {
@include e(content) {
display: inline-block;
height: 40px;
line-height: 40px;
font-size: 15px;
}
@include e(icon) {
margin-right: 10px;
display: inline-flex;
height: 40px;
line-height: 40px;
align-items: center;
@include b(icon) {
@include b(base-loading) {
@include icon-switch-transition();
}
svg {
@include icon-switch-transition();
}
font-size: 20px;
}
}
@include e(close) {
height: 40px;
display: flex;
align-items: center;
font-size: 19px;
margin-left: 12px;
}
}
@include e(close) {
@include b(icon) {
cursor: pointer;
fill: map-get($--message-close-color, 'default');
stroke: map-get($--message-close-color, 'default');
&:hover {
fill: map-get($--message-close-color, 'hover');
stroke: map-get($--message-close-color, 'hover');
}
&:active {
fill: map-get($--message-close-color, 'active');
stroke: map-get($--message-close-color, 'active');
}
}
}
@include m(closable) {
padding-right: 24px;
}
@include message-type-mixin('info');
@include message-type-mixin('success');
@include message-type-mixin('error');
@include message-type-mixin('warning');
@include message-type-mixin('loading');
}
}