Skip to content

Commit 1ae64f2

Browse files
committed
Smooth dialog transition
1 parent 3078886 commit 1ae64f2

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

src/components/confirm-dialog/confirm-dialog.module.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@
1313
z-index: 10000;
1414
padding: 16px;
1515
box-sizing: border-box;
16+
animation: fadeIn 0.2s ease-in-out;
17+
}
18+
19+
@keyframes fadeIn {
20+
from {
21+
opacity: 0;
22+
}
23+
to {
24+
opacity: 1;
25+
}
26+
}
27+
28+
@media (prefers-reduced-motion: reduce) {
29+
.overlay {
30+
animation: none;
31+
}
1632
}
1733

1834
.dialog {
@@ -29,6 +45,24 @@
2945
flex-direction: column;
3046
align-items: center;
3147
gap: 16px;
48+
animation: slideUp 0.2s ease-in-out;
49+
}
50+
51+
@keyframes slideUp {
52+
from {
53+
opacity: 0;
54+
transform: scale(0.95) translateY(-10px);
55+
}
56+
to {
57+
opacity: 1;
58+
transform: scale(1) translateY(0);
59+
}
60+
}
61+
62+
@media (prefers-reduced-motion: reduce) {
63+
.dialog {
64+
animation: none;
65+
}
3266
}
3367

3468
.closeButton {

src/components/confirm-dialog/confirm-dialog.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ export default function ConfirmDialog({
110110
}
111111
};
112112

113-
if (!isOpen) return null;
113+
if (!isOpen) {
114+
return null;
115+
}
114116

115117
return (
116118
<div

0 commit comments

Comments
 (0)