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 = () => {
4040 return (
4141 < motion . li
4242 key = { currentSnippet . title + idx }
43- layoutId = { currentSnippet . title + ( idx + 1 ) . toString ( ) }
43+ layoutId = { currentSnippet . title + ( idx + 1 ) . toString ( ) } // unique id for layout animation
4444 initial = { { opacity : 0 , y : 20 } }
4545 animate = { {
4646 opacity : 1 ,
@@ -69,6 +69,7 @@ const SnippetList = () => {
6969 onClick = { ( ) =>
7070 handleOpenModal ( {
7171 ...currentSnippet ,
72+ // added idx for the layout animation to work correctly
7273 idx : idx + 1 ,
7374 } )
7475 }
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ const SnippetModal: React.FC<Props> = ({
4949 key = "modal-content"
5050 className = "modal | flow"
5151 data-flow-space = "lg"
52- layoutId = { snippet . title + snippet . idx ?. toString ( ) }
52+ layoutId = { snippet . title + snippet . idx ?. toString ( ) } // unique id for layout animation
5353 transition = { { type : "spring" , duration : shouldReduceMotion ? 0 : 0.5 } }
5454 >
5555 < div className = "modal__header" >
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export type SnippetType = {
1414 code : string ;
1515 tags : string [ ] ;
1616 author : string ;
17- idx ?: number ; // Add optional idx property
17+ idx ?: number ;
1818} ;
1919
2020export type AppState = {
You can’t perform that action at this time.
0 commit comments