@@ -7,6 +7,7 @@ import { format, parseISO, startOfWeek } from "date-fns";
7
7
import { createEntry , deleteEntry , getEntries } from "~/model/entry.server" ;
8
8
import NavButton from "~/components/buttons/nav-button" ;
9
9
import RemoveButton from "~/components/buttons/remove-button" ;
10
+ import { AnimatePresence , motion } from "framer-motion" ;
10
11
11
12
export async function action ( { request } : ActionArgs ) {
12
13
const userId = await requireUserId ( request ) ;
@@ -62,24 +63,31 @@ function EntryList({ entries, title }: EntryListProps) {
62
63
return (
63
64
< div >
64
65
< p > { title } </ p >
65
- { entries . map ( ( entry ) => (
66
- < div key = { entry . id } >
67
- < ul className = "ml-8 list-disc" >
68
- < li >
69
- < span className = { "inline-flex items-baseline" } >
70
- < Link
71
- to = { entry . id }
72
- prefetch = { "intent" }
73
- className = { "mr-2 hover:text-gray-300" }
74
- >
75
- { entry . text }
76
- </ Link >
77
- < RemoveButton id = { entry . id } />
78
- </ span >
79
- </ li >
80
- </ ul >
81
- </ div >
82
- ) ) }
66
+ < div >
67
+ < ul className = "ml-8 list-disc" >
68
+ < AnimatePresence >
69
+ { entries . map ( ( entry ) => (
70
+ < motion . li
71
+ key = { entry . id }
72
+ initial = { { height : 0 , opacity : 0 } }
73
+ animate = { { height : 24 , opacity : 1 } }
74
+ exit = { { height : 0 , opacity : 0 } }
75
+ >
76
+ < span className = { "inline-flex items-baseline" } >
77
+ < Link
78
+ to = { entry . id }
79
+ prefetch = { "intent" }
80
+ className = { "mr-2 hover:text-gray-300" }
81
+ >
82
+ { entry . text }
83
+ </ Link >
84
+ < RemoveButton id = { entry . id } />
85
+ </ span >
86
+ </ motion . li >
87
+ ) ) }
88
+ </ AnimatePresence >
89
+ </ ul >
90
+ </ div >
83
91
</ div >
84
92
) ;
85
93
}
0 commit comments