From eee8e16ca03af0b27c025627bcb191782aaebe88 Mon Sep 17 00:00:00 2001 From: notshop Date: Sun, 26 Apr 2026 16:34:59 +0000 Subject: [PATCH] chore: add client/src/components/layout/CartDrawer.tsx --- client/src/components/layout/CartDrawer.tsx | 90 +++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 client/src/components/layout/CartDrawer.tsx diff --git a/client/src/components/layout/CartDrawer.tsx b/client/src/components/layout/CartDrawer.tsx new file mode 100644 index 0000000..47e9992 --- /dev/null +++ b/client/src/components/layout/CartDrawer.tsx @@ -0,0 +1,90 @@ +import { X, Trash2, ShoppingBag } from "lucide-react"; +import { Link } from "wouter"; +import { useCart } from "../../hooks/use-cart"; + +export default function CartDrawer() { + const { items, isOpen, closeCart, updateQuantity, removeItem, subtotal } = useCart(); + + if (!isOpen) return null; + + return ( + <> +
+
+
+

Your Cart

+ +
+ + {items.length === 0 ? ( +
+ +

Your cart is empty

+ +
+ ) : ( + <> +
+ {items.map((item) => ( +
+ {item.imageUrl && ( + {item.title} + )} +
+

{item.title}

+ {item.variantTitle && item.variantTitle !== "Default Title" && ( +

{item.variantTitle}

+ )} +

${parseFloat(item.price).toFixed(2)}

+
+ + {item.quantity} + + +
+
+
+ ))} +
+ +
+
+ Subtotal + ${subtotal.toFixed(2)} +
+

Taxes and shipping calculated at checkout

+ + Checkout · ${subtotal.toFixed(2)} + +
+ + )} +
+ + ); +}