import { useEffect } from "react"; import { X, Plus, Minus, Trash2 } from "lucide-react"; import { motion, AnimatePresence } from "motion/react"; import Button from "@/components/ui/Button"; import ImageOrVideo from "@/components/ui/ImageOrVideo"; type CartItem = { id: string; name: string; price: string; quantity: number; imageSrc: string; }; type ProductCartProps = { isOpen: boolean; onClose: () => void; items: CartItem[]; total: string; onQuantityChange?: (id: string, quantity: number) => void; onRemove?: (id: string) => void; onCheckout?: () => void; }; const ProductCart = ({ isOpen, onClose, items, total, onQuantityChange, onRemove, onCheckout }: ProductCartProps) => { useEffect(() => { if (!isOpen) return; const onKeyDown = (e: KeyboardEvent) => e.key === "Escape" && onClose(); document.addEventListener("keydown", onKeyDown); return () => document.removeEventListener("keydown", onKeyDown); }, [isOpen, onClose]); useEffect(() => { document.body.style.overflow = isOpen ? "hidden" : ""; return () => { document.body.style.overflow = ""; }; }, [isOpen]); return ( {isOpen && (

Cart ({items.length})

{items.length === 0 ? (

Your cart is empty

) : (
{items.map((item) => (

{item.name}

{item.price}

{item.quantity}
))}
)}
Total {total}
)} ); }; export default ProductCart; export type { CartItem };