|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
import React, {useState} from "react"; |
|
|
|
|
import React, { useState } from "react"; |
|
|
|
|
import { connect } from "react-redux"; |
|
|
|
|
import { userProduct } from "../../../redux/actions"; |
|
|
|
|
import separate from "../../../utils/separate"; |
|
|
|
@ -10,6 +10,7 @@ import exitIcon from "../../../assets/icons/exit.svg"; |
|
|
|
|
import deleteIcon from "../../../assets/icons/delete.svg"; |
|
|
|
|
|
|
|
|
|
function Product({ product, grades, pushToCart, isMobile, loading }) { |
|
|
|
|
let id; |
|
|
|
|
return isMobile ? ( |
|
|
|
|
<div className="flex flex-row justify-between py-5 border-b border-solid border-grayDB dark:border-gray45"> |
|
|
|
|
<div className="flex flex-row"> |
|
|
|
@ -89,7 +90,12 @@ function Product({ product, grades, pushToCart, isMobile, loading }) { |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
) : ( |
|
|
|
|
<div className="flex flex-row w-full gap-10 py-4 border-b border-solid border-gray-200"> |
|
|
|
|
<div |
|
|
|
|
className="flex flex-row w-full gap-10 py-4 border-b border-solid border-gray-200" |
|
|
|
|
onClick={() => { |
|
|
|
|
id = product?.id; |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<div className="w-3/4 flex flex-row"> |
|
|
|
|
<img |
|
|
|
|
src={"https://dnvn.ir/api/v1/file/" + product?.product?.book?.fileIds} |
|
|
|
@ -119,7 +125,7 @@ function Product({ product, grades, pushToCart, isMobile, loading }) { |
|
|
|
|
</div> |
|
|
|
|
<div className="w-1/4 flex flex-row items-center"> |
|
|
|
|
<button |
|
|
|
|
className="rounded-md pt-2 pb-1.5 px-3 border border-solid border-blueC0 text-blueC0 text-lg ffont-bold" |
|
|
|
|
className="rounded-md pt-1 px-1.5 border border-solid border-blueC0 text-blueC0 text-lg font-bold" |
|
|
|
|
onClick={() => |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: product?.productId, |
|
|
|
@ -130,8 +136,12 @@ function Product({ product, grades, pushToCart, isMobile, loading }) { |
|
|
|
|
> |
|
|
|
|
+ |
|
|
|
|
</button> |
|
|
|
|
<span className="mx-2.5 font-semibold text-lg text-green4F w-8 flex justify-center"> |
|
|
|
|
{loading ? <Loading size={2} color="bg-green-500" /> : product.count} |
|
|
|
|
<span className="mx-2.5 font-semibold text-5xl text-green4F w-8 flex justify-center"> |
|
|
|
|
{loading ? ( |
|
|
|
|
<Loading size={2} color="bg-green-500" /> |
|
|
|
|
) : ( |
|
|
|
|
product.count |
|
|
|
|
)} |
|
|
|
|
</span> |
|
|
|
|
{ |
|
|
|
|
<> |
|
|
|
@ -154,7 +164,7 @@ function Product({ product, grades, pushToCart, isMobile, loading }) { |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<button |
|
|
|
|
className="rounded-md pt-2 pb-1.5 font-bold px-3.5 border border-solid border-blueC0 text-blueC0 dark:border-blueC0 dark:text-blueC0 text-lg" |
|
|
|
|
className="rounded-md px-2 font-bold border border-solid border-blueC0 text-blueC0 dark:border-blueC0 dark:text-blueC0 text-2xl" |
|
|
|
|
onClick={() => |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: product?.productId, |
|
|
|
|