amis2/scss/components/_toast.scss

190 lines
3.6 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
@keyframes bounceIn {
from,
20%,
40%,
60%,
80%,
to {
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
2019-04-30 11:11:25 +08:00
0% {
opacity: 0;
transform: scale3d(0.3, 0.3, 0.3);
}
2019-04-30 11:11:25 +08:00
20% {
transform: scale3d(1.1, 1.1, 1.1);
}
2019-04-30 11:11:25 +08:00
40% {
transform: scale3d(0.9, 0.9, 0.9);
}
2019-04-30 11:11:25 +08:00
60% {
opacity: 1;
transform: scale3d(1.03, 1.03, 1.03);
}
2019-04-30 11:11:25 +08:00
80% {
transform: scale3d(0.97, 0.97, 0.97);
}
2019-04-30 11:11:25 +08:00
to {
opacity: 1;
transform: scale3d(1, 1, 1);
}
}
@keyframes bounceOut {
20% {
transform: scale3d(0.9, 0.9, 0.9);
}
2019-04-30 11:11:25 +08:00
50%,
55% {
opacity: 1;
transform: scale3d(1.1, 1.1, 1.1);
}
2019-04-30 11:11:25 +08:00
to {
opacity: 0;
transform: scale3d(0.3, 0.3, 0.3);
}
}
.#{$ns}Toast {
&-wrap {
pointer-events: none;
position: fixed;
z-index: $zindex-toast;
}
width: $Toast-width;
pointer-events: auto;
margin-bottom: $gap-xs;
padding: $Toast-paddingY $Toast-paddingX $Toast-paddingY
($Toast-paddingX + $Toast-paddingL);
2019-04-30 11:11:25 +08:00
box-shadow: $Toast-box-shadow;
border-radius: $Toast-borderRadius;
border: $Toast-border-width solid;
color: $Toast-color;
2019-04-30 11:11:25 +08:00
position: relative;
opacity: $Toast-opacity;
cursor: pointer;
&:hover {
opacity: 1;
}
2019-04-30 11:11:25 +08:00
&.in {
animation-duration: 0.75s;
animation-name: bounceIn;
}
&.out {
animation-duration: 0.75s;
animation-name: bounceOut;
}
&.hidden {
display: none;
}
&-title {
display: $Toast-display;
font-size: $fontSizeMd;
}
2019-04-30 11:11:25 +08:00
&-body {
display: $Toast-display;
}
2019-04-30 11:11:25 +08:00
&::before {
display: inline-block;
font-family: $Toast-iconVendor;
font-size: $Toast-icon-fontSize;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
position: absolute;
left: $Toast-paddingX;
top: $Toast-paddingY;
}
2019-04-30 11:11:25 +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
&::before {
content: $Toast--error-icon;
}
}
&--warning {
color: $Toast--warning-color;
border-color: $Toast--warning-borderColor;
background-color: $Toast--warning-bgColor;
2019-04-30 11:11:25 +08:00
&::before {
content: $Toast--warning-icon;
}
}
2019-04-30 11:11:25 +08:00
&--info {
color: $Toast--info-color;
border-color: $Toast--info-borderColor;
background-color: $Toast--info-bgColor;
padding: $Toast-paddingY $Toast-paddingX $Toast-paddingY
($Toast-paddingX + $Toast--info-paddingL);
2019-04-30 11:11:25 +08:00
&::before {
content: $Toast--info-icon;
}
}
2019-04-30 11:11:25 +08:00
&--success {
color: $Toast--success-color;
border-color: $Toast--success-borderColor;
background-color: $Toast--success-bgColor;
2019-04-30 11:11:25 +08:00
&::before {
content: $Toast--success-icon;
}
}
2019-04-30 11:11:25 +08:00
// 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;
}
}