Skip to content

Commit 18af294

Browse files
committed
refactor: 토스트 추가
1 parent 9296129 commit 18af294

17 files changed

+558
-47
lines changed

.pnp.cjs

Lines changed: 196 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818
"dependencies": {
1919
"@radix-ui/react-dialog": "^1.1.5",
20+
"@radix-ui/react-toast": "^1.2.6",
2021
"@radix-ui/react-visually-hidden": "^1.1.1",
2122
"@tanstack/react-query": "^5.64.2",
2223
"canvas-confetti": "^1.9.3",

src/components/ui/Toast/Toast.module.scss

Lines changed: 92 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,99 @@
1919
}
2020
}
2121

22+
// .Toast {
23+
// width: 100%;
24+
// height: 3.25rem;
25+
// z-index: 2;
26+
// border-radius: 0.75rem;
27+
// background-color: white;
28+
// padding: 0.875rem 1.125rem;
29+
30+
// transition:
31+
// opacity 0.3s,
32+
// transform 0.3s;
33+
// }
34+
35+
// .show {
36+
// opacity: 1;
37+
// transform: translateY(0);
38+
// }
39+
40+
// .ToastRoot[data-state="open"] {
41+
// animation: slideUp 150ms cubic-bezier(0.16, 1, 0.3, 1);
42+
// }
43+
// .ToastRoot[data-state="closed"] {
44+
// animation: hide 100ms ease-in;
45+
// }
46+
47+
// @keyframes hide {
48+
// from {
49+
// opacity: 1;
50+
// }
51+
// to {
52+
// opacity: 0;
53+
// }
54+
// }
55+
56+
// @keyframes slideUp {
57+
// from {
58+
// transform: translateY(100%);
59+
// opacity: 0;
60+
// }
61+
// to {
62+
// transform: translateY(0);
63+
// opacity: 1;
64+
// }
65+
// }
66+
67+
.ToastViewport {
68+
position: fixed;
69+
left: 50%;
70+
top: 0.75rem;
71+
z-index: 9999;
72+
width: fit-content;
73+
display: flex;
74+
flex-direction: column;
75+
gap: 0.5rem;
76+
transform: translateX(-50%);
77+
}
78+
2279
.Toast {
23-
width: 100%;
24-
height: 3.25rem;
25-
z-index: 2;
26-
border-radius: 0.75rem;
27-
background-color: white;
28-
padding: 0.875rem 1.125rem;
29-
30-
transition:
31-
opacity 0.3s,
32-
transform 0.3s;
80+
&[data-swipe="cancel"] {
81+
transform: translateX(0);
82+
}
83+
&[data-swipe="end"] {
84+
transform: translateX(var(--radix-toast-swipe-end-x));
85+
}
86+
&[data-swipe="move"] {
87+
transform: translateX(var(--radix-toast-swipe-move-x));
88+
}
89+
&[data-state="open"] {
90+
animation: slide-in-from-top 0.3s ease-out forwards;
91+
}
92+
&[data-state="closed"] {
93+
animation: slide-out-to-top 0.3s ease-in forwards;
94+
}
95+
}
96+
97+
@keyframes slide-in-from-top {
98+
from {
99+
opacity: 0;
100+
transform: translateY(-10px);
101+
}
102+
to {
103+
opacity: 1;
104+
transform: translateY(0);
105+
}
33106
}
34107

35-
.show {
36-
opacity: 1;
37-
transform: translateY(0);
108+
@keyframes slide-out-to-top {
109+
from {
110+
opacity: 1;
111+
transform: translateY(0);
112+
}
113+
to {
114+
opacity: 0;
115+
transform: translateY(-10px);
116+
}
38117
}

0 commit comments

Comments
 (0)