@@ -34,39 +34,44 @@ const SnippetList = () => {
34
34
< motion . ul
35
35
role = "list"
36
36
className = "snippets"
37
- initial = "hidden"
38
- animate = "visible"
39
- variants = { {
40
- visible : {
41
- transition : {
42
- staggerChildren : 0.1
43
- }
44
- }
45
- } }
46
37
>
47
- { fetchedSnippets . map ( ( snippet , idx ) => (
48
- < motion . li
49
- key = { idx }
50
- variants = { {
51
- hidden : { opacity : 0 , y : 20 } ,
52
- visible : { opacity : 1 , y : 0 }
53
- } }
54
- >
55
- < motion . button
56
- className = "snippet | flow"
57
- data-flow-space = "sm"
58
- onClick = { ( ) => handleOpenModal ( snippet ) }
59
- whileHover = { { scale : 1.01 } }
60
- whileTap = { { scale : 0.98 } }
38
+ < AnimatePresence mode = "popLayout" >
39
+ { fetchedSnippets . map ( ( snippet , idx ) => (
40
+ < motion . li
41
+ key = { idx }
42
+ initial = { { opacity : 0 , y : 20 } }
43
+ animate = { {
44
+ opacity : 1 ,
45
+ y : 0 ,
46
+ transition : {
47
+ delay : idx * 0.05 ,
48
+ duration : 0.2
49
+ }
50
+ } }
51
+ exit = { {
52
+ opacity : 0 ,
53
+ y : - 20 ,
54
+ transition : {
55
+ delay : ( fetchedSnippets . length - 1 - idx ) * 0.01 ,
56
+ duration : 0.09
57
+ }
58
+ } }
61
59
>
62
- < div className = "snippet__preview" >
63
- < img src = { language . icon } alt = { language . lang } />
64
- </ div >
65
-
66
- < h3 className = "snippet__title" > { snippet . title } </ h3 >
67
- </ motion . button >
68
- </ motion . li >
69
- ) ) }
60
+ < motion . button
61
+ className = "snippet | flow"
62
+ data-flow-space = "sm"
63
+ onClick = { ( ) => handleOpenModal ( snippet ) }
64
+ whileHover = { { scale : 1.01 } }
65
+ whileTap = { { scale : 0.98 } }
66
+ >
67
+ < div className = "snippet__preview" >
68
+ < img src = { language . icon } alt = { language . lang } />
69
+ </ div >
70
+ < h3 className = "snippet__title" > { snippet . title } </ h3 >
71
+ </ motion . button >
72
+ </ motion . li >
73
+ ) ) }
74
+ </ AnimatePresence >
70
75
</ motion . ul >
71
76
72
77
< AnimatePresence mode = "wait" >
0 commit comments