diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-16 10:00:38 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-16 10:00:38 +0700 |
| commit | b22c0e52dc08083025330ef0a501e085cbf434df (patch) | |
| tree | 079601d5a1abe26e5da4a80ea926e5d687a188f5 | |
| parent | 8f310309ea811d7524f90ffc43db29c1dd291c1a (diff) | |
<iman> add button lihat semua
| -rw-r--r-- | src-migrate/pages/shop/promo/index.tsx | 3 | ||||
| -rw-r--r-- | src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 15 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src-migrate/pages/shop/promo/index.tsx b/src-migrate/pages/shop/promo/index.tsx index 7bb5546d..2ebfc008 100644 --- a/src-migrate/pages/shop/promo/index.tsx +++ b/src-migrate/pages/shop/promo/index.tsx @@ -24,11 +24,10 @@ const PromoPage = () => { /> <PromoList selectedPromo={selectedPromo} /> </LazyLoadComponent> - + <h1 className='sm:h-1'></h1> <LazyLoadComponent> <FlashSale /> </LazyLoadComponent> - <h1 className='h-1'></h1> <LazyLoadComponent> <FlashSaleNonDisplay /> </LazyLoadComponent> diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx index 3218ab35..0068c98d 100644 --- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx +++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx @@ -7,33 +7,46 @@ import ProductSlider from '@/lib/product/components/ProductSlider'; import flashSaleApi from '../api/flashSaleApi'; import { FlashSaleSkeleton } from '../skeleton/FlashSaleSkeleton'; +import Link from 'next/link'; +import { useRouter } from 'next/router' const FlashSaleNonDisplay = () => { const [flashSales, setFlashSales] = useState(null); const [isLoading, setIsLoading] = useState(true); + const [pencarian, setPencarian] = useState(''); + const router = useRouter() useEffect(() => { const loadFlashSales = async () => { const dataFlashSales = await flashSaleApi(); setFlashSales(dataFlashSales); + setPencarian(`fq=-flashsale_id_i:${dataFlashSales[0]?.pricelistId}&fq=flashsale_price_f:[1 TO *]&orderBy=flashsale-discount-desc`) setIsLoading(false); }; loadFlashSales(); }, []); + const handleSubmit = () => { + router.push(`/shop/search?${pencarian}`) + } + if (isLoading) { return <FlashSaleSkeleton />; } + return ( flashSales?.length > 0 && ( <div className='px-4 sm:px-0 grid grid-cols-1 gap-y-8'> {flashSales.map((flashSale, index) => ( <div key={index}> - <div className='flex gap-x-3 mb-4 justify-between sm:justify-start'> + <div className='flex items-center mb-4 justify-between '> <div className='font-medium sm:text-h-lg mt-1.5'> Penawaran Terbatas </div> + <div onClick={handleSubmit} className='!text-red-500 font-semibold cursor-pointer'> + Lihat Semua + </div> </div> <div className='relative'> |
