import React from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { useNavigate } from 'react-router-dom'; import { useStore } from '../src/context/StoreContext'; const Cart: React.FC = () => { const { cart, isCartOpen, setCartOpen, removeFromCart, updateQuantity } = useStore(); const navigate = useNavigate(); const subtotal = cart.reduce((total, item) => total + (item.price * item.quantity), 0); const handleCheckout = () => { setCartOpen(false); navigate('/checkout'); }; return ( {isCartOpen && ( <> {/* Backdrop */} setCartOpen(false)} className="fixed inset-0 bg-black/30 backdrop-blur-sm z-[60]" /> {/* Drawer */} {/* Header */}

Your Bag

{/* Items List */}
{cart.length === 0 ? (
shopping_bag

Your bag is empty

) : ( cart.map((item) => (
{item.title}

{item.title}

Ref. {item.number}

{item.quantity}

${(item.price * item.quantity).toFixed(2)}

)) )}
{/* Footer */} {cart.length > 0 && (
Subtotal ${subtotal.toFixed(2)}

Shipping & taxes calculated at checkout

)}
)}
); }; export default Cart;