File tree Expand file tree Collapse file tree 3 files changed +4
-3
lines changed Expand file tree Collapse file tree 3 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const SnippetList = () => {
40
40
return (
41
41
< motion . li
42
42
key = { currentSnippet . title + idx }
43
- layoutId = { currentSnippet . title + ( idx + 1 ) . toString ( ) }
43
+ layoutId = { currentSnippet . title + ( idx + 1 ) . toString ( ) } // unique id for layout animation
44
44
initial = { { opacity : 0 , y : 20 } }
45
45
animate = { {
46
46
opacity : 1 ,
@@ -69,6 +69,7 @@ const SnippetList = () => {
69
69
onClick = { ( ) =>
70
70
handleOpenModal ( {
71
71
...currentSnippet ,
72
+ // added idx for the layout animation to work correctly
72
73
idx : idx + 1 ,
73
74
} )
74
75
}
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ const SnippetModal: React.FC<Props> = ({
49
49
key = "modal-content"
50
50
className = "modal | flow"
51
51
data-flow-space = "lg"
52
- layoutId = { snippet . title + snippet . idx ?. toString ( ) }
52
+ layoutId = { snippet . title + snippet . idx ?. toString ( ) } // unique id for layout animation
53
53
transition = { { type : "spring" , duration : shouldReduceMotion ? 0 : 0.5 } }
54
54
>
55
55
< div className = "modal__header" >
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export type SnippetType = {
14
14
code : string ;
15
15
tags : string [ ] ;
16
16
author : string ;
17
- idx ?: number ; // Add optional idx property
17
+ idx ?: number ;
18
18
} ;
19
19
20
20
export type AppState = {
You can’t perform that action at this time.
0 commit comments