@@ -24,58 +24,59 @@ const SnippetModal: React.FC<Props> = ({
24
24
useEscapeKey ( handleCloseModal ) ;
25
25
26
26
return ReactDOM . createPortal (
27
- < AnimatePresence >
27
+ < motion . div
28
+ key = "modal-overlay"
29
+ className = "modal-overlay"
30
+ onClick = { ( e ) => {
31
+ if ( e . target === e . currentTarget ) {
32
+ handleCloseModal ( ) ;
33
+ }
34
+ } }
35
+ initial = { { opacity : 0 } }
36
+ animate = { { opacity : 1 } }
37
+ exit = { { opacity : 0 } }
38
+ transition = { { duration : 0.2 } }
39
+ >
28
40
< motion . div
29
- className = "modal-overlay"
30
- onClick = { ( e ) => {
31
- if ( e . target === e . currentTarget ) {
32
- handleCloseModal ( ) ;
33
- }
34
- } }
35
- initial = { { opacity : 0 } }
36
- animate = { { opacity : 1 } }
37
- exit = { { opacity : 0 } }
41
+ key = "modal-content"
42
+ className = "modal | flow"
43
+ data-flow-space = "lg"
44
+ initial = { { scale : 0.8 , opacity : 0 , y : 20 } }
45
+ animate = { { scale : 1 , opacity : 1 , y : 0 } }
46
+ exit = { { scale : 0.8 , opacity : 0 , y : 20 } }
47
+ transition = { { type : "spring" , duration : 0.5 } }
38
48
>
39
- < motion . div
40
- className = "modal | flow"
41
- data-flow-space = "lg"
42
- initial = { { scale : 0.8 , opacity : 0 , y : 20 } }
43
- animate = { { scale : 1 , opacity : 1 , y : 0 } }
44
- exit = { { scale : 0.8 , opacity : 0 , y : 20 } }
45
- transition = { { type : "spring" , duration : 0.5 } }
46
- >
47
- < div className = "modal__header" >
48
- < h2 className = "section-title" > { snippet . title } </ h2 >
49
- < Button isIcon = { true } onClick = { handleCloseModal } >
50
- < CloseIcon />
51
- </ Button >
52
- </ div >
53
- < CodePreview language = { slugify ( language ) } code = { snippet . code } />
54
- < p >
55
- < b > Description: </ b >
56
- { snippet . description }
57
- </ p >
58
- < p >
59
- Contributed by{ " " }
60
- < a
61
- href = { `https://github.com/${ snippet . author } ` }
62
- target = "_blank"
63
- rel = "noopener noreferrer"
64
- className = "styled-link"
65
- >
66
- @{ snippet . author }
67
- </ a >
68
- </ p >
69
- < ul role = "list" className = "modal__tags" >
70
- { snippet . tags . map ( ( tag ) => (
71
- < li key = { tag } className = "modal__tag" >
72
- { tag }
73
- </ li >
74
- ) ) }
75
- </ ul >
76
- </ motion . div >
49
+ < div className = "modal__header" >
50
+ < h2 className = "section-title" > { snippet . title } </ h2 >
51
+ < Button isIcon = { true } onClick = { handleCloseModal } >
52
+ < CloseIcon />
53
+ </ Button >
54
+ </ div >
55
+ < CodePreview language = { slugify ( language ) } code = { snippet . code } />
56
+ < p >
57
+ < b > Description: </ b >
58
+ { snippet . description }
59
+ </ p >
60
+ < p >
61
+ Contributed by{ " " }
62
+ < a
63
+ href = { `https://github.com/${ snippet . author } ` }
64
+ target = "_blank"
65
+ rel = "noopener noreferrer"
66
+ className = "styled-link"
67
+ >
68
+ @{ snippet . author }
69
+ </ a >
70
+ </ p >
71
+ < ul role = "list" className = "modal__tags" >
72
+ { snippet . tags . map ( ( tag ) => (
73
+ < li key = { tag } className = "modal__tag" >
74
+ { tag }
75
+ </ li >
76
+ ) ) }
77
+ </ ul >
77
78
</ motion . div >
78
- </ AnimatePresence > ,
79
+ </ motion . div > ,
79
80
modalRoot
80
81
) ;
81
82
} ;
0 commit comments