feat: add Framer Motion animations with spring physics and reduced-motion support
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { format, isPast, isToday } from "date-fns";
|
||||
import { motion, useReducedMotion } from "framer-motion";
|
||||
import { useSortable } from "@dnd-kit/sortable";
|
||||
import { CSS } from "@dnd-kit/utilities";
|
||||
import type { Card, Label } from "@/types/board";
|
||||
@@ -13,6 +14,8 @@ interface CardThumbnailProps {
|
||||
}
|
||||
|
||||
export function CardThumbnail({ card, boardLabels, columnId, onCardClick }: CardThumbnailProps) {
|
||||
const prefersReducedMotion = useReducedMotion();
|
||||
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
@@ -40,11 +43,14 @@ export function CardThumbnail({ card, boardLabels, columnId, onCardClick }: Card
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
<motion.button
|
||||
ref={setNodeRef}
|
||||
style={style}
|
||||
onClick={handleClick}
|
||||
className="w-full rounded-lg bg-pylon-surface p-3 shadow-sm text-left transition-all duration-200 hover:-translate-y-px hover:shadow-md"
|
||||
initial={prefersReducedMotion ? false : { opacity: 0, y: -8 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ type: "spring", stiffness: 300, damping: 25 }}
|
||||
{...attributes}
|
||||
{...listeners}
|
||||
>
|
||||
@@ -77,6 +83,6 @@ export function CardThumbnail({ card, boardLabels, columnId, onCardClick }: Card
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</button>
|
||||
</motion.button>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user