amis/scss/components/_toast.scss

211 lines
3.6 KiB
SCSS

@keyframes bounceIn {
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);
}
}
@keyframes bounceOut {
20% {
transform: scale3d(0.9, 0.9, 0.9);
}
50%,
55% {
opacity: 1;
transform: scale3d(1.1, 1.1, 1.1);
}
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;
@if $Toast-icon-fillHeight {
padding: $Toast-paddingY
$Toast-paddingX
$Toast-paddingY
($Toast-paddingX + $Toast-paddingL);
} @else {
padding: $Toast-paddingY $Toast-paddingX;
}
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;
}
&-close {
position: absolute;
top: $gap-xs;
right: $gap-sm;
color: $Toast-close-color;
line-height: 1;
opacity: 0.8;
&:hover {
color: $Toast-close--onHover-color;
opacity: 1;
}
}
&-title {
display: $Toast-title-display;
margin-right: $gap-base;
font-size: $fontSizeMd;
vertical-align: middle;
}
&-body {
display: $Toast-title-display;
vertical-align: middle;
}
&-icon {
display: inline-flex;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
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;
}
}
// colors
&--error {
color: $Toast--danger-color;
border-color: $Toast--danger-borderColor;
background-color: $Toast--danger-bgColor;
}
&--warning {
color: $Toast--warning-color;
border-color: $Toast--warning-borderColor;
background-color: $Toast--warning-bgColor;
}
&--info {
color: $Toast--info-color;
border-color: $Toast--info-borderColor;
background-color: $Toast--info-bgColor;
}
&--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;
}
}