feat: add stagger animations to board list and board cards
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useState } from "react";
|
||||
import { formatDistanceToNow } from "date-fns";
|
||||
import { motion, useReducedMotion } from "framer-motion";
|
||||
import { fadeSlideUp, springs, subtleHover } from "@/lib/motion";
|
||||
import { Trash2, Copy } from "lucide-react";
|
||||
import {
|
||||
ContextMenu,
|
||||
@@ -26,10 +27,9 @@ import { deleteBoard, loadBoard, saveBoard } from "@/lib/storage";
|
||||
|
||||
interface BoardCardProps {
|
||||
board: BoardMeta;
|
||||
index?: number;
|
||||
}
|
||||
|
||||
export function BoardCard({ board, index = 0 }: BoardCardProps) {
|
||||
export function BoardCard({ board }: BoardCardProps) {
|
||||
const [confirmDelete, setConfirmDelete] = useState(false);
|
||||
const prefersReducedMotion = useReducedMotion();
|
||||
const addToast = useToastStore((s) => s.addToast);
|
||||
@@ -74,9 +74,12 @@ export function BoardCard({ board, index = 0 }: BoardCardProps) {
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
initial={prefersReducedMotion ? false : { opacity: 0, y: 10 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ type: "spring", stiffness: 300, damping: 25, delay: index * 0.05 }}
|
||||
variants={fadeSlideUp}
|
||||
initial={prefersReducedMotion ? false : "hidden"}
|
||||
animate="visible"
|
||||
transition={springs.bouncy}
|
||||
whileHover={subtleHover.hover}
|
||||
whileTap={subtleHover.tap}
|
||||
>
|
||||
<ContextMenu>
|
||||
<ContextMenuTrigger asChild>
|
||||
|
||||
Reference in New Issue
Block a user