File tree Expand file tree Collapse file tree 4 files changed +57
-20
lines changed
Expand file tree Collapse file tree 4 files changed +57
-20
lines changed Original file line number Diff line number Diff line change 55}
66
77/* prettier-ignore */
8- @keyframes in {
8+ @keyframes flip- in {
99 from { opacity : 0 ; transform : rotateX (-10deg ); }
1010 to { opacity : 1 ; transform : rotateX (0deg ); }
1111}
1212
1313/* prettier-ignore */
14- @keyframes out {
14+ @keyframes flip- out {
1515 from { opacity : 1 ; transform : rotateX (0deg ); }
1616 to { opacity : 0 ; transform : rotateX (-10deg ); }
1717}
1818
1919.flip [data-state = "open" ] {
20- animation-name : in;
21- animation-duration : 200 ms ;
20+ animation-name : flip- in;
21+ animation-duration : 0.2 s ;
2222}
2323
2424.flip [data-state = "closed" ] {
25- animation-name : out;
26- animation-duration : 600ms ;
25+ animation-name : flip-out;
26+ animation-duration : 0.6s ;
27+ }
28+
29+ /* Fade */
30+
31+ .fade {
32+ will-change : opacity;
33+ animation-timing-function : var (--ease );
34+ }
35+
36+ /* prettier-ignore */
37+ @keyframes fade-in { from { opacity : 0 ; } to { opacity : 1 ; } }
38+
39+ /* prettier-ignore */
40+ @keyframes fade-out { from { opacity : 1 ; } to { opacity : 0 ; } }
41+
42+ .fade [data-state = "open" ] {
43+ animation-name : fade-in;
44+ animation-duration : 0.4s ;
45+ }
46+
47+ .fade [data-state = "closed" ] {
48+ animation-name : fade-out;
49+ animation-duration : 0.8s ;
2750}
Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ import * as s from "./animation.module.css";
22
33export const animation = {
44 flip : s . flip ,
5+ fade : s . fade ,
56} ;
Original file line number Diff line number Diff line change 11.overlay {
2- background-color : var (--color-base );
2+ background-color : rgba ( var (--color-base-rgb ) , 0.8 );
33 position : fixed;
44 inset : 0 ;
5- opacity : 0.8 ;
65}
76
8- .content {
7+ .container {
98 position : fixed;
10- top : 50% ;
11- left : 50% ;
12- transform : translate (-50% , -50% );
9+ inset : 0 ;
10+
11+ display : flex;
12+ align-items : center;
13+ justify-content : center;
14+
15+ perspective : 100vh ;
16+ }
1317
18+ .content {
1419 padding : 18px ;
1520 display : flex;
1621 flex-direction : column;
Original file line number Diff line number Diff line change 11import * as Radix from "@radix-ui/react-alert-dialog" ;
22import { ReactNode } from "react" ;
3+ import { animation } from "../animation/animation" ;
34import { Card } from "../card/card" ;
45import * as s from "./dialog.module.css" ;
56
@@ -15,14 +16,21 @@ const Content = (props: Props): JSX.Element => {
1516 const { title, description, buttons } = props ;
1617 return (
1718 < Radix . Portal >
18- < Radix . Overlay className = { s . overlay } />
19- < Radix . Content className = { [ s . content , Card . glass ] . join ( " " ) } >
20- < Radix . Title className = { s . title } > { title } </ Radix . Title >
21- < Radix . Description className = { s . description } >
22- { description }
23- </ Radix . Description >
24- < div className = { s . footer } > { buttons } </ div >
25- </ Radix . Content >
19+ < Radix . Overlay
20+ className = { [ s . overlay , animation . fade ] . join ( " " ) }
21+ > </ Radix . Overlay >
22+ { /* Container to apply transform animation to Content */ }
23+ < div className = { s . container } >
24+ < Radix . Content
25+ className = { [ s . content , Card . glass , animation . flip ] . join ( " " ) }
26+ >
27+ < Radix . Title className = { s . title } > { title } </ Radix . Title >
28+ < Radix . Description className = { s . description } >
29+ { description }
30+ </ Radix . Description >
31+ < div className = { s . footer } > { buttons } </ div >
32+ </ Radix . Content >
33+ </ div >
2634 </ Radix . Portal >
2735 ) ;
2836} ;
You can’t perform that action at this time.
0 commit comments