From 556a7f8fe21cddca52980c7418ad09c46838a141 Mon Sep 17 00:00:00 2001 From: mike Date: Sat, 12 Oct 2024 13:59:08 -0400 Subject: [PATCH] feat: add shopping cart --- shopping-cart/src/Cart.jsx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/shopping-cart/src/Cart.jsx b/shopping-cart/src/Cart.jsx index e69de29..44b5c76 100644 --- a/shopping-cart/src/Cart.jsx +++ b/shopping-cart/src/Cart.jsx @@ -0,0 +1,30 @@ +const Cart = (props) => { + return ( +
+ {props.cart ? ( +
+

Cart

+ {props.cart.map((item) => + + )} +
+ ) : (

Your cart is empty

)} + +
+ ) +} + + +function CartItem({item, qty}) { + const {name, price, img} = item; + + return ( +
+ {name} +

{name}

+

Qty: {qty}

+

{price}

+

{price * qty}

+
+ ) +} \ No newline at end of file