From e82cd0d4756b869f3741aebf6fa6f5989e9131da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sof=C3=ADa=20Maturana?= Date: Wed, 8 Apr 2026 13:48:11 -0400 Subject: [PATCH] feat: agregar total al carrito --- src/Cart.jsx | 82 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 35 deletions(-) diff --git a/src/Cart.jsx b/src/Cart.jsx index a452353..f648251 100644 --- a/src/Cart.jsx +++ b/src/Cart.jsx @@ -4,42 +4,54 @@ import { pizzaCart } from "./pizzas"; const Cart = () => { const [cart, setCart] = useState(pizzaCart); return ( -
- {cart.map((pizza) => ( -
-

Pizza {pizza.name}

-
- -

{pizza.count}

- +
+

Carrito

+

+ Total: + + {` $${cart.reduce((acc, it) => acc + it.price * it.count, 0).toLocaleString("es-CL")}`} + +

+
+ {cart.map((pizza) => ( +
+

Pizza {pizza.name}

+
+ +

{pizza.count}

+ +
-
- ))} -
+ ))} +
+ ); };