"use client"; import Image from "next/image"; import PersianNumber from "plugins/PersianNumber"; import React, { useContext } from "react"; import p1 from "../../../public/images/product/1.png"; import p2 from "../../../public/images/product/2.png"; import AppContext from "@ctx/AppContext"; const CardCart = ({ data }) => { const CTX = useContext(AppContext); console.log("data", data); return (

{data?.persianName}

{data?.hasDiscount && (

{" "} 3 عدد موجود انبار

)}
{/*{cart.find(e=>id)}*/} {data?.count < 0 ? (
CTX.AddItemToCart(data.id, data.persianName)} >
) : (
CTX.AddItemToCart(data.id)} >

+

CTX.RemoveItemFromCart(data.id)} >

-

)}
{data?.hasDiscount ? (

{" "}

تومان
) : (
{" "}

تومان
)}
); }; export default CardCart;