diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-10-04 12:05:14 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-10-04 12:05:14 +0700 |
| commit | f0df1a21f6a53baa12a7e44300ac2035adeb7f53 (patch) | |
| tree | f8e8f699fd7f60b17394ec0588b8b99a6b40996f /src/lib/cart | |
| parent | 5624207e88c272a8edde9c334393bca5ac20d3fc (diff) | |
mobile version
Diffstat (limited to 'src/lib/cart')
| -rw-r--r-- | src/lib/cart/components/Cart.jsx | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index acd23af6..5716d01b 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -32,7 +32,7 @@ const Cart = () => { const [cart, setCart] = useState(null) - const {setRefreshCart} = useProductCartContext() + const { setRefreshCart } = useProductCartContext() useEffect(() => { if (!auth) return @@ -115,7 +115,7 @@ const Cart = () => { selected: true }).then(() => { getCart().then(() => { - if(promotionActiveId){ + if (promotionActiveId) { setPromotionType(false) } }) @@ -438,7 +438,7 @@ const Cart = () => { product.program.items && product.program.items.map((item) => ( <div key={item.id} className='flex mx-4 relative'> - <ComponentCanBuy canBuy={product.canBuy} /> + <ComponentCanBuy canBuy={product.canBuy} /> <input className='mr-2 accent-danger-500 w-4' /> <Link href={createSlug( @@ -685,19 +685,25 @@ const Cart = () => { </td> <td className='relative'> <ComponentCanBuy canBuy={product.canBuy} /> - {product?.hasFlashsale && ( - <div className='flex gap-x-1 items-center justify-center mt-3'> - <div className='text-gray_r-11 line-through text-caption-1'> - {currencyFormat(product?.price?.price)} + {product?.hasFlashsale ? ( + <> + <div className='flex gap-x-1 items-center justify-center mt-3'> + <div className='text-gray_r-11 line-through text-caption-1'> + {currencyFormat(product?.price?.price)} + </div> + <div className='badge-solid-red'> + {product?.price?.discountPercentage}% + </div> </div> - <div className='badge-solid-red'> - {product?.price?.discountPercentage}% + <div className='font-normal mt-1'> + {currencyFormat(product?.price?.priceDiscount)} </div> + </> + ) : ( + <div className='font-normal mt-1'> + {currencyFormat(product?.price?.price)} </div> )} - <div className='font-normal mt-1'> - {currencyFormat(product?.price?.priceDiscount)} - </div> </td> <td className='relative'> <ComponentCanBuy canBuy={product.canBuy} /> |
