Skip to content

Commit 490ad5e

Browse files
committed
Core: Toast - updated MD styles
1 parent d67e280 commit 490ad5e

3 files changed

Lines changed: 78 additions & 44 deletions

File tree

src/core/components/toast/toast-ios.less

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,49 @@
22
@import (multiple) '../../less/colors-ios.less';
33

44
.toast {
5+
transition-duration: 450ms;
56
background: rgba(0,0,0,0.75);
67
opacity: 0;
8+
width: 100%;
9+
left: 0;
710

811
@supports (backdrop-filter: blur(10px)) {
912
background: rgba(0,0,0,0.65);
1013
backdrop-filter: blur(10px);
1114
}
1215

1316
&.toast-center {
17+
width: auto;
18+
left: 50%;
1419
border-radius: 8px;
20+
transform: translate3d(-50%, -50%, 0);
21+
&.modal-in {
22+
transform: translate3d(-50%, -50%, 0);
23+
opacity: 1;
24+
}
25+
}
26+
&.toast-top {
27+
top: 0;
28+
transform: translate3d(0, -100%, 0);
29+
&.modal-in {
30+
transform: translate3d(0, 0%, 0);
31+
opacity: 1;
32+
}
33+
}
34+
&.toast-bottom {
35+
bottom: 0;
36+
transform: translate3d(0, 100%, 0);
37+
&.modal-in {
38+
transform: translate3d(0, 0%, 0);
39+
opacity: 1;
40+
}
41+
}
42+
@media (min-width: 569px) {
43+
left: 50%;
44+
margin-left: -568px / 2;
45+
&.toast-center {
46+
margin-left: 0;
47+
}
1548
}
1649

1750
@media (min-width: 569px) {
@@ -24,6 +57,8 @@
2457
}
2558
}
2659
@media (min-width: 1024px) {
60+
margin-left: 0;
61+
width: auto;
2762
&.toast-bottom, &.toast-top {
2863
left: 15px;
2964
}

src/core/components/toast/toast-md.less

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,50 @@
11
.md {
22
@import (multiple) '../../less/colors-md.less';
33
.toast {
4+
transition-duration: 200ms;
5+
border-radius: 4px;
46
background: #323232;
7+
opacity: 0;
8+
left: 8px;
9+
width: ~"calc(100% - 16px)";
10+
transform: scale(0.9);
11+
&.modal-in {
12+
transform: scale(1);
13+
opacity: 1;
14+
}
15+
&.modal-out {
16+
transform: scale(1);
17+
opacity: 0;
18+
}
519
&.toast-center {
6-
border-radius: 2px;
20+
left: 50%;
21+
width: auto;
722
background: rgba(0,0,0,0.75);
23+
transform: scale(0.9) translate3d(-55%, -55%, 0);
24+
&.modal-in {
25+
transform: scale(1) translate3d(-50%, -50%, 0);
26+
}
27+
&.modal-out {
28+
transform: scale(1) translate3d(-50%, -50%, 0);
29+
}
830
}
9-
@media (min-width: 569px) {
10-
border-radius: 2px;
31+
&.toast-bottom {
32+
bottom: 8px;
33+
}
34+
&.toast-top {
35+
top: 8px;
36+
}
37+
// 568 + 16
38+
@media (min-width: 584px) {
39+
left: 50%;
40+
margin-left: -568px / 2;
41+
&.toast-center {
42+
margin-left: 0;
43+
}
1144
}
1245
@media (min-width: 1024px) {
46+
margin-left: 0;
47+
width: auto;
1348
&.toast-bottom, &.toast-top {
1449
left: 24px;
1550
}
@@ -47,8 +82,8 @@
4782
}
4883
@media (min-width: 1024px) {
4984
&.modal-in {
50-
transform: translate3d(0, ~"calc(0px - constant(safe-area-inset-bottom))", 0);
51-
transform: translate3d(0, ~"calc(0px - env(safe-area-inset-bottom))", 0);
85+
margin-bottom: constant(safe-area-inset-bottom);
86+
margin-bottom: env(safe-area-inset-bottom);
5287
}
5388
}
5489
}

src/core/components/toast/toast.less

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
/* === Toast === */
22
.toast {
3-
transition-duration: 450ms;
43
transition-property: transform, opacity;
54
position: absolute;
6-
width: 100%;
75
max-width: 568px;
8-
left: 0;
96
z-index: 20000;
107
color: #fff;
118
font-size: 14px;
129
box-sizing: border-box;
13-
10+
&.modal-in {
11+
opacity: 1;
12+
}
1413
.toast-content {
1514
display: flex;
1615
justify-content: space-between;
@@ -46,46 +45,11 @@
4645
}
4746
&.toast-center {
4847
top: 50%;
49-
left: 50%;
50-
width: auto;
5148
opacity: 0;
52-
transform: translate3d(-50%, -50%, 0);
53-
&.modal-in {
54-
transform: translate3d(-50%, -50%, 0);
55-
opacity: 1;
56-
}
57-
}
58-
&.toast-top {
59-
top: 0;
60-
transform: translate3d(0, -100%, 0);
61-
&.modal-in {
62-
transform: translate3d(0, 0%, 0);
63-
opacity: 1;
64-
}
65-
}
66-
&.toast-bottom {
67-
bottom: 0;
68-
transform: translate3d(0, 100%, 0);
69-
&.modal-in {
70-
transform: translate3d(0, 0%, 0);
71-
opacity: 1;
72-
}
7349
}
7450

75-
@media (min-width: 569px) {
76-
left: 50%;
77-
margin-left: -568px / 2;
78-
&.toast-center {
79-
margin-left: 0;
80-
}
81-
}
8251
@media (min-width: 1024px) {
8352
opacity: 0;
84-
margin-left: auto;
85-
width: auto;
86-
&.toast-center {
87-
margin-left: 0;
88-
}
8953
}
9054
}
9155

0 commit comments

Comments
 (0)