diff --git a/src/components/board/BoardView.tsx b/src/components/board/BoardView.tsx index c6bbc46..2af0c61 100644 --- a/src/components/board/BoardView.tsx +++ b/src/components/board/BoardView.tsx @@ -1,6 +1,6 @@ import React, { useState, useRef, useEffect, useCallback } from "react"; import { Plus } from "lucide-react"; -import { motion } from "framer-motion"; +import { AnimatePresence, motion } from "framer-motion"; import { staggerContainer } from "@/lib/motion"; import { DndContext, @@ -387,12 +387,14 @@ export function BoardView() { {/* Drag overlay - renders a styled copy of the dragged item */} - - {activeCard ? ( - - ) : activeColumn ? ( - - ) : null} + + + {activeCard ? ( + + ) : activeColumn ? ( + + ) : null} + diff --git a/src/components/board/DragOverlayContent.tsx b/src/components/board/DragOverlayContent.tsx index 901cef6..6aabee8 100644 --- a/src/components/board/DragOverlayContent.tsx +++ b/src/components/board/DragOverlayContent.tsx @@ -1,7 +1,10 @@ +import { useRef } from "react"; +import { motion, useMotionValue, animate } from "framer-motion"; import type { Card, Column, Label } from "@/types/board"; import { LabelDots } from "@/components/board/LabelDots"; import { ChecklistBar } from "@/components/board/ChecklistBar"; import { format, isPast, isToday } from "date-fns"; +import { springs } from "@/lib/motion"; interface CardOverlayProps { card: Card; @@ -13,8 +16,32 @@ export function CardOverlay({ card, boardLabels }: CardOverlayProps) { const dueDate = hasDueDate ? new Date(card.dueDate!) : null; const overdue = dueDate != null && isPast(dueDate) && !isToday(dueDate); + const rotate = useMotionValue(0); + const lastX = useRef(0); + return ( -
+ { + const deltaX = e.clientX - lastX.current; + lastX.current = e.clientX; + const tilt = Math.max(-5, Math.min(5, deltaX * 0.3)); + animate(rotate, tilt, { type: "spring", stiffness: 300, damping: 20 }); + }} + > + {/* Cover color bar */} + {card.coverColor && ( +
+ )} + {/* Label dots */} {card.labels.length > 0 && (
@@ -25,7 +52,7 @@ export function CardOverlay({ card, boardLabels }: CardOverlayProps) { {/* Card title */}

{card.title}

- {/* Footer row: due date + checklist */} + {/* Footer row */} {(hasDueDate || card.checklist.length > 0) && (
{dueDate && ( @@ -44,7 +71,7 @@ export function CardOverlay({ card, boardLabels }: CardOverlayProps) { )}
)} -
+ ); } @@ -54,7 +81,13 @@ interface ColumnOverlayProps { export function ColumnOverlay({ column }: ColumnOverlayProps) { return ( -
+
{column.title} @@ -65,10 +98,7 @@ export function ColumnOverlay({ column }: ColumnOverlayProps) {
{column.cardIds.slice(0, 3).map((_, i) => ( -
+
))} {column.cardIds.length > 3 && (

@@ -76,6 +106,6 @@ export function ColumnOverlay({ column }: ColumnOverlayProps) {

)}
-
+ ); }