/* eslint-disable react/prop-types */ import { useContext, useState } from "react"; import { CartContext } from "../cartContext"; import { crossIcon, crossSecond } from "../../assets/SvgIcons/svgIcons"; export default function Cart({ showModal, toggle }) { const { cartItems, addToCart, removeFromCart, removeItem, clearCart, getCartTotal, } = useContext(CartContext); const [checkout, setCheckout] = useState(""); const handleCheckOut = () => { setCheckout("Your Order has been checked out"); setTimeout(() => { setCheckout(""); }, 3000); }; return ( showModal && (

Total: ${getCartTotal()}

{cartItems?.length > 0 ? (
{checkout && (

{checkout}

)}
) : (

Your cart is empty

)}

Cart Details

{cartItems?.map((item) => (
{item?.title}

{item?.title}

${item?.price}

{item?.quantity}

))}
) ); }