Spaces:
Running
Running
gpt-engineer-app[bot]
commited on
Commit
·
78dc268
1
Parent(s):
4efd7ff
Add fade-in effect to dialog
Browse filesThe commit adds a fade-in effect to the dialog when it opens. This addresses a previous issue where the effect was not fully implemented.
- src/components/ui/dialog.tsx +2 -2
- src/index.css +15 -6
src/components/ui/dialog.tsx
CHANGED
|
@@ -19,7 +19,7 @@ const DialogOverlay = React.forwardRef<
|
|
| 19 |
<DialogPrimitive.Overlay
|
| 20 |
ref={ref}
|
| 21 |
className={cn(
|
| 22 |
-
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
| 23 |
className
|
| 24 |
)}
|
| 25 |
{...props}
|
|
@@ -36,7 +36,7 @@ const DialogContent = React.forwardRef<
|
|
| 36 |
<DialogPrimitive.Content
|
| 37 |
ref={ref}
|
| 38 |
className={cn(
|
| 39 |
-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
| 40 |
className
|
| 41 |
)}
|
| 42 |
{...props}
|
|
|
|
| 19 |
<DialogPrimitive.Overlay
|
| 20 |
ref={ref}
|
| 21 |
className={cn(
|
| 22 |
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 dialog-overlay",
|
| 23 |
className
|
| 24 |
)}
|
| 25 |
{...props}
|
|
|
|
| 36 |
<DialogPrimitive.Content
|
| 37 |
ref={ref}
|
| 38 |
className={cn(
|
| 39 |
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dialog-content",
|
| 40 |
className
|
| 41 |
)}
|
| 42 |
{...props}
|
src/index.css
CHANGED
|
@@ -46,12 +46,14 @@
|
|
| 46 |
|
| 47 |
@keyframes scale-up {
|
| 48 |
from {
|
| 49 |
-
transform: scale(0.
|
| 50 |
opacity: 0;
|
|
|
|
| 51 |
}
|
| 52 |
to {
|
| 53 |
transform: scale(1);
|
| 54 |
opacity: 1;
|
|
|
|
| 55 |
}
|
| 56 |
}
|
| 57 |
|
|
@@ -59,43 +61,50 @@
|
|
| 59 |
from {
|
| 60 |
transform: scale(1);
|
| 61 |
opacity: 1;
|
|
|
|
| 62 |
}
|
| 63 |
to {
|
| 64 |
-
transform: scale(0.
|
| 65 |
opacity: 0;
|
|
|
|
| 66 |
}
|
| 67 |
}
|
| 68 |
|
| 69 |
.dialog-content {
|
| 70 |
-
animation: scale-up 0.
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
.dialog-overlay {
|
| 74 |
-
animation: fade-in 0.
|
| 75 |
}
|
| 76 |
|
| 77 |
[data-state="closed"] .dialog-content {
|
| 78 |
-
animation: scale-down 0.
|
| 79 |
}
|
| 80 |
|
| 81 |
[data-state="closed"] .dialog-overlay {
|
| 82 |
-
animation: fade-out 0.
|
| 83 |
}
|
| 84 |
|
| 85 |
@keyframes fade-in {
|
| 86 |
from {
|
| 87 |
opacity: 0;
|
|
|
|
| 88 |
}
|
| 89 |
to {
|
| 90 |
opacity: 1;
|
|
|
|
| 91 |
}
|
| 92 |
}
|
| 93 |
|
| 94 |
@keyframes fade-out {
|
| 95 |
from {
|
| 96 |
opacity: 1;
|
|
|
|
| 97 |
}
|
| 98 |
to {
|
| 99 |
opacity: 0;
|
|
|
|
| 100 |
}
|
| 101 |
}
|
|
|
|
| 46 |
|
| 47 |
@keyframes scale-up {
|
| 48 |
from {
|
| 49 |
+
transform: scale(0.8);
|
| 50 |
opacity: 0;
|
| 51 |
+
filter: blur(8px);
|
| 52 |
}
|
| 53 |
to {
|
| 54 |
transform: scale(1);
|
| 55 |
opacity: 1;
|
| 56 |
+
filter: blur(0);
|
| 57 |
}
|
| 58 |
}
|
| 59 |
|
|
|
|
| 61 |
from {
|
| 62 |
transform: scale(1);
|
| 63 |
opacity: 1;
|
| 64 |
+
filter: blur(0);
|
| 65 |
}
|
| 66 |
to {
|
| 67 |
+
transform: scale(0.8);
|
| 68 |
opacity: 0;
|
| 69 |
+
filter: blur(8px);
|
| 70 |
}
|
| 71 |
}
|
| 72 |
|
| 73 |
.dialog-content {
|
| 74 |
+
animation: scale-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
|
| 75 |
+
will-change: transform, opacity, filter;
|
| 76 |
}
|
| 77 |
|
| 78 |
.dialog-overlay {
|
| 79 |
+
animation: fade-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
|
| 80 |
}
|
| 81 |
|
| 82 |
[data-state="closed"] .dialog-content {
|
| 83 |
+
animation: scale-down 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
| 84 |
}
|
| 85 |
|
| 86 |
[data-state="closed"] .dialog-overlay {
|
| 87 |
+
animation: fade-out 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
| 88 |
}
|
| 89 |
|
| 90 |
@keyframes fade-in {
|
| 91 |
from {
|
| 92 |
opacity: 0;
|
| 93 |
+
backdrop-filter: blur(0px);
|
| 94 |
}
|
| 95 |
to {
|
| 96 |
opacity: 1;
|
| 97 |
+
backdrop-filter: blur(4px);
|
| 98 |
}
|
| 99 |
}
|
| 100 |
|
| 101 |
@keyframes fade-out {
|
| 102 |
from {
|
| 103 |
opacity: 1;
|
| 104 |
+
backdrop-filter: blur(4px);
|
| 105 |
}
|
| 106 |
to {
|
| 107 |
opacity: 0;
|
| 108 |
+
backdrop-filter: blur(0px);
|
| 109 |
}
|
| 110 |
}
|