amis2/scss/components/_toast.scss

271 lines
4.9 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 {
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: flex-start;
2019-12-06 09:58:08 +08:00
&-wrap {
pointer-events: none;
position: fixed;
z-index: $zindex-toast;
}
2021-09-24 11:22:46 +08:00
max-width: var(--Toast-width);
2019-12-06 09:58:08 +08:00
pointer-events: auto;
margin-bottom: var(--gap-xs);
2020-06-09 14:44:38 +08:00
2021-09-24 11:22:46 +08:00
padding: var(--Toast-paddingY) var(--Toast-paddingX);
2020-06-09 14:44:38 +08:00
box-shadow: var(--Toast-box-shadow);
border-radius: var(--Toast-borderRadius);
border: var(--Toast-border-width) solid;
color: var(--Toast-color);
2019-12-06 09:58:08 +08:00
position: relative;
opacity: var(--Toast-opacity);
2019-12-06 09:58:08 +08:00
opacity: 0;
transform: translateZ(0);
&.in,
&.out {
animation-fill-mode: both;
animation-duration: var(--animation-duration);
2019-12-06 09:58:08 +08:00
opacity: 1;
}
&.in {
animation-name: bounceIn;
}
&.out {
animation-name: bounceOut;
}
2019-12-29 10:48:53 +08:00
&-close {
2021-09-24 11:22:46 +08:00
display: inline-flex;
font-size: var(--fontSizeLg);
line-height: var(--gap-xl);
height: var(--gap-xl);
color: var(--Toast-close-color);
margin-left: var(--gap-sm);
2019-12-29 10:48:53 +08:00
opacity: 0.8;
align-items: center;
cursor: pointer;
2019-12-29 10:48:53 +08:00
&:hover {
color: var(--Toast-close--onHover-color);
2019-12-29 10:48:53 +08:00
opacity: 1;
}
& > svg {
top: 0;
}
2019-12-29 10:48:53 +08:00
}
&-content {
flex: 1;
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
align-items: flex-start;
.#{$ns}Toast-title {
color: var(--text-color);
font-size: var(--fontSizeBase);
font-weight: 500;
line-height: var(--gap-xl);
margin-bottom: var(--gap-xs);
}
.#{$ns}Toast-body {
font-size: var(--fontSizeSm);
display: inline-block;
vertical-align: middle;
white-space: pre-wrap;
flex-grow: 1;
line-height: var(--gap-xl);
2021-12-06 10:21:05 +08:00
.#{$ns}Html {
word-break: break-word;
}
}
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;
margin-right: var(--gap-sm);
height: var(--gap-xl);
line-height: var(--gap-xl);
align-items: center;
2020-06-09 14:44:38 +08:00
> svg {
top: 0;
width: var(--Toast-icon-width);
height: var(--Toast-icon-height);
2020-06-09 14:44:38 +08:00
color: inherit;
}
2019-12-06 09:58:08 +08:00
}
// colors
&--error {
color: var(--Toast--danger-color);
border-color: var(--Toast--danger-borderColor);
background: var(--Toast--danger-bgColor);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&--warning {
color: var(--Toast--warning-color);
border-color: var(--Toast--warning-borderColor);
background: var(--Toast--warning-bgColor);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&--info {
color: var(--Toast--info-color);
border-color: var(--Toast--info-borderColor);
background: var(--Toast--info-bgColor);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&--success {
color: var(--Toast--success-color);
border-color: var(--Toast--success-borderColor);
background: var(--Toast--success-bgColor);
2019-12-06 09:58:08 +08:00
}
// positions
&-wrap--topRight {
top: var(--gap-base);
right: var(--gap-base);
2019-12-06 09:58:08 +08:00
}
&-wrap--topCenter {
top: var(--gap-base);
2019-12-06 09:58:08 +08:00
left: 50%;
transform: translateX(-50%);
2019-12-06 09:58:08 +08:00
}
&-wrap--topLeft {
top: var(--gap-base);
left: var(--gap-base);
2019-12-06 09:58:08 +08:00
}
&-wrap--bottomLeft {
left: var(--gap-base);
bottom: var(--gap-base);
2019-12-06 09:58:08 +08:00
}
&-wrap--bottomCenter {
left: 50%;
transform: translateX(-50%);
bottom: var(--gap-base);
2019-12-06 09:58:08 +08:00
}
&-wrap--bottomRight {
bottom: var(--gap-base);
right: var(--gap-base);
2019-12-06 09:58:08 +08:00
}
&-wrap--center {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
.#{$ns}Toast-mobile {
.#{$ns}Toast {
background-color: rgba($color: #000000, $alpha: 0.9);
border-radius: px2rem(4px);
color: #fff;
flex-direction: column;
align-items: center;
justify-content: center;
padding: var(--gap-base) var(--gap-md);
text-align: center;
&-title {
color: #fff;
width: 100%;
}
&-body {
line-height: px2rem(18px);
font-size: var(--fontSizeMd);
}
&-icon {
margin-right: 0 !important;
margin: var(--gap-base) 0;
width: px2rem(40px);
height: px2rem(40px);
> svg {
width: px2rem(40px);
height: px2rem(40px);
}
}
}
& &--has-icon {
min-width: px2rem(120px);
padding-bottom: var(--gap-lg);
}
2019-12-06 09:58:08 +08:00
}