amis/scss/components/_toast.scss

211 lines
3.6 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
@keyframes bounceIn {
2019-12-06 09:58:08 +08:00
from,
20%,
40%,
60%,
80%,
to {
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
0% {
opacity: 0;
transform: scale3d(0.3, 0.3, 0.3);
}
20% {
transform: scale3d(1.1, 1.1, 1.1);
}
40% {
transform: scale3d(0.9, 0.9, 0.9);
}
60% {
opacity: 1;
transform: scale3d(1.03, 1.03, 1.03);
}
80% {
transform: scale3d(0.97, 0.97, 0.97);
}
to {
opacity: 1;
transform: scale3d(1, 1, 1);
}
2019-04-30 11:11:25 +08:00
}
@keyframes bounceOut {
2019-12-06 09:58:08 +08:00
20% {
transform: scale3d(0.9, 0.9, 0.9);
}
2019-12-06 09:58:08 +08:00
50%,
55% {
opacity: 1;
transform: scale3d(1.1, 1.1, 1.1);
}
2019-12-06 09:58:08 +08:00
to {
opacity: 0;
transform: scale3d(0.3, 0.3, 0.3);
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Toast {
2019-12-06 09:58:08 +08:00
&-wrap {
pointer-events: none;
position: fixed;
z-index: $zindex-toast;
}
width: $Toast-width;
pointer-events: auto;
margin-bottom: $gap-xs;
2020-06-09 14:44:38 +08:00
@if $Toast-icon-fillHeight {
padding: $Toast-paddingY
$Toast-paddingX
$Toast-paddingY
($Toast-paddingX + $Toast-paddingL);
} @else {
padding: $Toast-paddingY $Toast-paddingX;
}
2019-12-06 09:58:08 +08:00
box-shadow: $Toast-box-shadow;
border-radius: $Toast-borderRadius;
border: $Toast-border-width solid;
color: $Toast-color;
position: relative;
opacity: $Toast-opacity;
cursor: pointer;
opacity: 0;
transform: translateZ(0);
&.in,
&.out {
animation-fill-mode: both;
animation-duration: 0.75s;
opacity: 1;
}
&.in {
animation-name: bounceIn;
}
&.out {
animation-name: bounceOut;
}
2019-12-29 10:48:53 +08:00
&-close {
position: absolute;
top: $gap-xs;
right: $gap-sm;
2020-06-09 14:44:38 +08:00
color: $Toast-close-color;
2019-12-29 10:48:53 +08:00
line-height: 1;
opacity: 0.8;
&:hover {
2020-06-09 14:44:38 +08:00
color: $Toast-close--onHover-color;
2019-12-29 10:48:53 +08:00
opacity: 1;
}
}
2019-12-06 09:58:08 +08:00
&-title {
2020-06-09 14:44:38 +08:00
display: $Toast-title-display;
2020-06-03 14:55:25 +08:00
margin-right: $gap-base;
2019-12-06 09:58:08 +08:00
font-size: $fontSizeMd;
2020-06-09 14:44:38 +08:00
vertical-align: middle;
2019-12-06 09:58:08 +08:00
}
&-body {
2020-06-09 14:44:38 +08:00
display: $Toast-title-display;
vertical-align: middle;
2019-12-06 09:58:08 +08:00
}
2020-06-09 14:44:38 +08:00
&-icon {
display: inline-flex;
2019-12-06 09:58:08 +08:00
text-rendering: auto;
-webkit-font-smoothing: antialiased;
2020-06-09 14:44:38 +08:00
vertical-align: middle;
@if $Toast-icon-fillHeight {
position: absolute;
left: $Toast-paddingX;
top: $Toast-paddingY;
width: $Toast-paddingL - $Toast-paddingX;
height: $Toast-paddingL - $Toast-paddingX;
align-items: center;
justify-content: center;
} @else {
margin-right: $gap-xs;
}
> svg {
top: 0;
width: $Toast-icon-width;
height: $Toast-icon-height;
color: inherit;
}
2019-12-06 09:58:08 +08:00
}
// colors
&--error {
color: $Toast--danger-color;
border-color: $Toast--danger-borderColor;
background-color: $Toast--danger-bgColor;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&--warning {
color: $Toast--warning-color;
border-color: $Toast--warning-borderColor;
background-color: $Toast--warning-bgColor;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&--info {
color: $Toast--info-color;
border-color: $Toast--info-borderColor;
background-color: $Toast--info-bgColor;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&--success {
color: $Toast--success-color;
border-color: $Toast--success-borderColor;
background-color: $Toast--success-bgColor;
}
// positions
&-wrap--topRight {
top: $gap-base;
right: $gap-base;
}
&-wrap--topCenter {
top: $gap-base;
left: 50%;
margin-left: -$Toast-width/2;
}
&-wrap--topLeft {
top: $gap-base;
left: $gap-base;
}
&-wrap--bottomLeft {
left: $gap-base;
bottom: $gap-base;
}
&-wrap--bottomCenter {
left: 50%;
margin-left: -$Toast-width/2;
bottom: $gap-base;
}
&-wrap--bottomRight {
bottom: $gap-base;
right: $gap-base;
}
}