feat(events-list): add AnimatePresence for list transitions and improve empty state

This commit is contained in:
2026-04-08 00:56:35 -04:00
parent c80322f20a
commit 8b54a661fe

View File

@@ -1,3 +1,6 @@
"use client";
import { AnimatePresence, motion } from "framer-motion";
import { Calendar1Icon } from "lucide-react"; import { Calendar1Icon } from "lucide-react";
import type { CalendarEvent } from "@/lib/types"; import type { CalendarEvent } from "@/lib/types";
import { EventCard } from "./event-card"; import { EventCard } from "./event-card";
@@ -11,28 +14,36 @@ interface EventsListProps {
export const EventsList = ({ events, onEdit, onDelete }: EventsListProps) => { export const EventsList = ({ events, onEdit, onDelete }: EventsListProps) => {
if (events.length === 0) { if (events.length === 0) {
return ( return (
<div className="flex flex-col items-center justify-center py-8 text-center"> <motion.div
<Calendar1Icon className="h-12 w-12 text-muted-foreground mb-4" /> initial={{ opacity: 0 }}
<h3 className="text-lg font-medium text-muted-foreground"> animate={{ opacity: 1 }}
No events yet className="flex flex-col items-center justify-center py-16 text-center"
</h3> >
<p className="text-sm text-muted-foreground"> <div className="glass-card p-6 inline-flex flex-col items-center">
Create your first event to get started <Calendar1Icon className="h-10 w-10 text-muted-foreground/40 mb-3" />
</p> <h3 className="text-sm font-medium text-muted-foreground">
</div> No events yet
</h3>
<p className="text-xs text-muted-foreground/60 mt-1">
Create your first event to get started
</p>
</div>
</motion.div>
); );
} }
return ( return (
<div className="space-y-4"> <div className="space-y-2">
{events.map((event) => ( <AnimatePresence mode="popLayout">
<EventCard {events.map((event) => (
key={event.id} <EventCard
event={event} key={event.id}
onEdit={onEdit} event={event}
onDelete={onDelete} onEdit={onEdit}
/> onDelete={onDelete}
))} />
))}
</AnimatePresence>
</div> </div>
); );
}; };