summaryrefslogtreecommitdiff
path: root/src/lib/product/components/ProductCard.jsx
diff options
context:
space:
mode:
authortrisusilo <tri.susilo@altama.co.id>2023-10-06 08:16:59 +0000
committertrisusilo <tri.susilo@altama.co.id>2023-10-06 08:16:59 +0000
commit5bc76488a76f2a1a39a501eba1685e0875f61030 (patch)
treec5aee34ead56a09f7d9194da95ccd27b3a53a52d /src/lib/product/components/ProductCard.jsx
parentb0333b521a3bc6e526b7c7b06d13680d8b1e9e01 (diff)
parent2ac1c3a84032ba819046e1634ca7c46ac0521e3b (diff)
Merged in CR/Pricelist (pull request #94)
add condisi if harga tier user lebih rendah dari flash sale
Diffstat (limited to 'src/lib/product/components/ProductCard.jsx')
-rw-r--r--src/lib/product/components/ProductCard.jsx29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 5f213fe9..91c1f40e 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -89,17 +89,16 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
>
{product?.name}
</Link>
- {product?.flashSale?.id > 0 ? (
+ {product?.flashSale?.id > 0 && product?.lowestPrice.discountPercentage > 0 ? (
<>
- {product?.lowestPrice.discountPercentage > 0 && (
- <div className='flex gap-x-1 mb-1 items-center'>
- <div className='text-gray_r-11 line-through text-[11px] sm:text-caption-2'>
- {currencyFormat(product.lowestPrice.price)}
- </div>
- <div className='badge-solid-red'>{Math.floor( product?.lowestPrice.discountPercentage)}%</div>
+ <div className='flex gap-x-1 mb-1 items-center'>
+ <div className='text-gray_r-11 line-through text-[11px] sm:text-caption-2'>
+ {currencyFormat(product.lowestPrice.price)}
</div>
- )}
-
+ <div className='badge-solid-red'>
+ {Math.floor(product?.lowestPrice.discountPercentage)}%
+ </div>
+ </div>
<div className='text-danger-500 font-semibold mb-2'>
{product?.lowestPrice.priceDiscount > 0 ? (
currencyFormat(product?.lowestPrice.priceDiscount)
@@ -114,7 +113,8 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
<>
{currencyFormat(product?.lowestPrice.price)}
<div className='text-gray_r-9 text-[10px] font-normal mt-2'>
- Inc. PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN )}
+ Inc. PPN:{' '}
+ {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)}
</div>
</>
) : (
@@ -192,11 +192,13 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
>
{product?.name}
</Link>
- {product?.flashSale?.id > 0 ? (
+ {product?.flashSale?.id > 0 && product?.lowestPrice?.discountPercentage > 0 ? (
<>
{product?.lowestPrice.discountPercentage > 0 && (
<div className='flex gap-x-1 mb-1 items-center'>
- <div className='badge-solid-red'>{Math.floor(product?.lowestPrice?.discountPercentage)}%</div>
+ <div className='badge-solid-red'>
+ {Math.floor(product?.lowestPrice?.discountPercentage)}%
+ </div>
<div className='text-gray_r-11 line-through text-caption-2'>
{currencyFormat(product?.lowestPrice?.price)}
</div>
@@ -217,7 +219,8 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
<>
{currencyFormat(product?.lowestPrice.price)}
<div className='text-gray_r-9 text-[11px] sm:text-caption-2 font-normal mt-2'>
- Inc. PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)}
+ Inc. PPN:{' '}
+ {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)}
</div>
</>
) : (