diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-08-03 14:22:27 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-08-03 14:22:27 +0700 |
| commit | 7f5b0518474f702b68ca459e5cb531212504472d (patch) | |
| tree | c8b98fd307e98365e90311a65edcd0bdaa9eaf87 /src/lib/product/components/ProductCard.jsx | |
| parent | 942b4c3548891f25198140b80192e9190a403ee5 (diff) | |
flash sale
Diffstat (limited to 'src/lib/product/components/ProductCard.jsx')
| -rw-r--r-- | src/lib/product/components/ProductCard.jsx | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index c85a76e9..b38bb43c 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -1,11 +1,14 @@ +import CountDown2 from '@/core/components/elements/CountDown/CountDown2' import Image from '@/core/components/elements/Image/Image' import Link from '@/core/components/elements/Link/Link' import currencyFormat from '@/core/utils/currencyFormat' import { createSlug } from '@/core/utils/slug' import whatsappUrl from '@/core/utils/whatsappUrl' import ImageNext from 'next/image' +import Product from './Product/Product' const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { + console.log('ini prodyct ', product) const callForPriceWhatsapp = whatsappUrl('product', { name: product.name, url: createSlug('/shop/product/', product.name, product.id, true) @@ -23,6 +26,23 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { alt={product?.name} className='w-full object-contain object-center h-36 sm:h-48' /> + {product?.flashSale?.id > 0 && ( + <div className='absolute bottom-0 bg-red-600 w-full h-10 grid'> + <div className='flex gap-x-1 items-center p-2 justify-center'> + <div className='bg-yellow-400 rounded-full p-1 h-6 w-19 flex items-center justify-center '> + <span className='text-sm font-bold'>{product?.lowestPrice.discountPercentage}%</span> + </div> + <div className='bg-red-600 border border-solid border-yellow-400 p-2 rounded-full h-6 flex w-fit items-center justify-center gap-x-2'> + <ImageNext + src='/images/ICON_FLASH_SALE_WEBSITE_INDOTEKNIK.svg' + width={13} + height={5} + /> + <span className='text-white text-[11px] font-semibold'>{product?.flashSale?.tag}</span> + </div> + </div> + </div> + )} {product.variantTotal > 1 && ( <div className='absolute badge-gray bottom-1.5 left-1.5'> {product.variantTotal} Varian @@ -30,20 +50,20 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { )} </Link> <div className='p-2 sm:p-3 pb-3 text-caption-2 sm:text-body-2 leading-5'> - {product?.manufacture?.name ? ( - <Link - href={createSlug( - '/shop/brands/', - product?.manufacture?.name, - product?.manufacture.id - )} - className='mb-1' - > - {product.manufacture.name} - </Link> - ) : ( - <div>-</div> - )} + {product?.manufacture?.name ? ( + <Link + href={createSlug( + '/shop/brands/', + product?.manufacture?.name, + product?.manufacture.id + )} + className='mb-1' + > + {product.manufacture.name} + </Link> + ) : ( + <div>-</div> + )} <Link href={createSlug('/shop/product/', product?.name, product?.id)} className={`mb-2 !text-gray_r-12 leading-6 block ${ @@ -104,7 +124,11 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { <div className='w-8/12 p-2'> {product.flashSale.id > 0 && ( <div className='bg-red-600 rounded-full mb-1 p-2 pl-3 pr-3 flex w-fit items-center gap-x-1'> - <ImageNext src='/images/ICON_FLASH_SALE_WEBSITE_INDOTEKNIK.svg' width={15} height={10} /> + <ImageNext + src='/images/ICON_FLASH_SALE_WEBSITE_INDOTEKNIK.svg' + width={15} + height={10} + /> <span className='text-white text-xs font-semibold'>FLASH SALE</span> </div> )} |
