summaryrefslogtreecommitdiff
path: root/src/lib/product/components/ProductCard.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/product/components/ProductCard.jsx')
-rw-r--r--src/lib/product/components/ProductCard.jsx31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 3b96ac32..c60e4f87 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -1,6 +1,7 @@
import Image from '@/core/components/elements/Image/Image'
import Link from '@/core/components/elements/Link/Link'
import currencyFormat from '@/core/utils/currencyFormat'
+import { sellingProductFormat } from '@/core/utils/formatValue'
import { createSlug } from '@/core/utils/slug'
import whatsappUrl from '@/core/utils/whatsappUrl'
import ImageNext from 'next/image'
@@ -82,9 +83,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
)}
<Link
href={createSlug('/shop/product/', product?.name, product?.id)}
- className={`mb-3 !text-gray_r-12 leading-6 block ${
- simpleTitle ? 'line-clamp-2 h-12' : 'line-clamp-3 h-[64px]'
- }`}
+ className={`mb-2 !text-gray_r-12 leading-6 block line-clamp-3 h-[64px]`}
title={product?.name}
>
{product?.name}
@@ -123,12 +122,11 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
</div>
)}
- {product?.stockTotal > 0 && (
- <div className='flex gap-x-1'>
- <div className='badge-solid-red'>Ready Stock</div>
- <div className='badge-gray'>{product?.stockTotal > 5 ? '> 5' : '< 5'}</div>
- </div>
- )}
+ <div className='flex w-full items-center gap-x-1 '>
+ {product?.stockTotal > 0 && <div className='badge-solid-red'>Ready Stock</div>}
+ {/* <div className='badge-gray'>{product?.stockTotal > 5 ? '> 5' : '< 5'}</div> */}
+ {product?.qtySold > 0 && <div className='text-gray_r-9 text-sm'>{sellingProductFormat(product?.qtySold) + ' Terjual'}</div>}
+ </div>
</div>
</div>
)
@@ -186,9 +184,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
)}
<Link
href={createSlug('/shop/product/', product?.name, product?.id)}
- className={`mb-3 !text-gray_r-12 leading-6 ${
- simpleTitle ? 'line-clamp-2' : 'line-clamp-3'
- }`}
+ className={`mb-3 !text-gray_r-12 leading-6 line-clamp-3`}
>
{product?.name}
</Link>
@@ -229,12 +225,11 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
</div>
)}
- {product?.stockTotal > 0 && (
- <div className='flex gap-x-1'>
- <div className='badge-solid-red'>Ready Stock</div>
- <div className='badge-gray'>{product?.stockTotal > 5 ? '> 5' : '< 5'}</div>
- </div>
- )}
+ <div className='flex w-full items-center gap-x-1 '>
+ {product?.stockTotal > 0 && <div className='badge-solid-red'>Ready Stock</div>}
+ {/* <div className='badge-gray'>{product?.stockTotal > 5 ? '> 5' : '< 5'}</div> */}
+ {product?.qtySold > 0 && <div className='text-gray_r-9 text-sm'>{sellingProductFormat(product?.qtySold) + ' Terjual'}</div>}
+ </div>
</div>
</div>
)