diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-10-21 10:06:54 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-10-21 10:06:54 +0700 |
| commit | a001da95b9c03167656aec8a573cf60c12164b3f (patch) | |
| tree | 54c8432bf9b1ec21648c6fae9faf94066c96987f /src/lib/product/components/ProductCard.jsx | |
| parent | 5c1f114b9e9feb256a49bfd60ed60c72823bca7c (diff) | |
| parent | bf33b9a9493aeab84e72647fad384bed43feabd5 (diff) | |
Merge branch 'master' into refactor/all
Diffstat (limited to 'src/lib/product/components/ProductCard.jsx')
| -rw-r--r-- | src/lib/product/components/ProductCard.jsx | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 3b96ac32..9500a3fd 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} @@ -103,7 +102,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { {product?.lowestPrice.priceDiscount > 0 ? ( currencyFormat(product?.lowestPrice.priceDiscount) ) : ( - <a href={callForPriceWhatsapp}>Call for price</a> + <a href={callForPriceWhatsapp}>Call for Inquiry</a> )} </div> </> @@ -118,17 +117,16 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { </div> </> ) : ( - <a href={callForPriceWhatsapp}>Call for price</a> + <a href={callForPriceWhatsapp}>Call for Inquiry</a> )} </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-[11px]'>{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> @@ -209,7 +205,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { {product?.lowestPrice?.priceDiscount > 0 ? ( currencyFormat(product?.lowestPrice?.priceDiscount) ) : ( - <a href={callForPriceWhatsapp}>Call for price</a> + <a href={callForPriceWhatsapp}>Call for Inquiry</a> )} </div> </> @@ -224,17 +220,16 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { </div> </> ) : ( - <a href={callForPriceWhatsapp}>Call for price</a> + <a href={callForPriceWhatsapp}>Call for Inquiry</a> )} </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-[11px]'>{sellingProductFormat(product?.qtySold) + ' Terjual'}</div>} + </div> </div> </div> ) |
