From 1a2b1f478d5ce2d2df0e6ca62678847d97b0989a Mon Sep 17 00:00:00 2001 From: Sidd-hant13 Date: Tue, 22 Oct 2024 00:45:23 +0530 Subject: [PATCH] fixing buttons --- src/components/CartItems.jsx | 160 +++++++++++++++++++---------------- 1 file changed, 85 insertions(+), 75 deletions(-) diff --git a/src/components/CartItems.jsx b/src/components/CartItems.jsx index 5a9ea66..b178a52 100644 --- a/src/components/CartItems.jsx +++ b/src/components/CartItems.jsx @@ -1,84 +1,94 @@ -import React, { useContext } from 'react'; -import { ShopContext } from '../context/ShopContext'; -import remove_icon from './assets/cart_cross_icon.png'; +import React, { useContext } from "react"; +import { ShopContext } from "../context/ShopContext"; +import remove_icon from "./assets/cart_cross_icon.png"; const CartItems = () => { - const { all_product, cartItems, removeToCart, getTotalCartAmount } = useContext(ShopContext); - - return ( -
-
-

Products

-

Title

-

New Price

-

Old Price

-

Quantity

-

Total

-

Remove

-
-
+ const { all_product, cartItems, removeToCart, getTotalCartAmount } = + useContext(ShopContext); - {all_product.map((e) => { - if (cartItems[e.id] > 0) { - return ( -
-
- {e.name} -

{e.name}

-

${e.new_price}

-

${e.old_price}

{/* Old Price with strikethrough */} - -

${e.new_price * cartItems[e.id]}

- { removeToCart(e.id) }} - alt="Remove" - /> -
-
-
- ); - } - return null; - })} + return ( +
+
+

Products

+

Title

+

New Price

+

Old Price

+

Quantity

+

Total

+

Remove

+
+
-
-
-

Cart Totals

-
-
-

Subtotal

-

${getTotalCartAmount()}

-
-
-
-

Shipping Fee

-

Free

-
-
-
-

Total

-

${getTotalCartAmount()}

-
-
- -
+ {all_product.map((e) => { + if (cartItems[e.id] > 0) { + return ( +
+
+ {e.name} +

{e.name}

+

${e.new_price}

+

+ ${e.old_price} +

{" "} + {/* Old Price with strikethrough */} +
{cartItems[e.id]}
+

${e.new_price * cartItems[e.id]}

+ { + removeToCart(e.id); + }} + alt="Remove" + /> +
+
+
+ ); + } + return null; + })} -
-

If you have a promo code, enter here!

-
- - -
-
+
+
+

Cart Totals

+
+
+

Subtotal

+

${getTotalCartAmount()}

+
+
+
+

Shipping Fee

+

Free

+
+
+

Total

+

${getTotalCartAmount()}

+
+
+ +
+ +
+

If you have a promo code, enter here!

+
+ + +
- ); -} +
+
+ ); +}; export default CartItems;