diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-06-28 03:26:38 +0000 |
|---|---|---|
| committer | trisusilo <tri.susilo@altama.co.id> | 2024-06-28 03:26:38 +0000 |
| commit | def7fc2f1201286c44545e1305ca9f11eb16f3d0 (patch) | |
| tree | 4c65db77b9aa28f3dd53ce514de9d918440c2887 /src/lib/home/components | |
| parent | 98d4f9564bfba66687848b335026bddb6f4dc5b6 (diff) | |
| parent | 936f7f9fb1c6951e02dd8a5f7e85fb8d39cc7e6a (diff) | |
Merged in promotion-program (pull request #140)
Promotion program
Approved-by: trisusilo
Diffstat (limited to 'src/lib/home/components')
| -rw-r--r-- | src/lib/home/components/PromotionProgram.jsx | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx new file mode 100644 index 00000000..66216d19 --- /dev/null +++ b/src/lib/home/components/PromotionProgram.jsx @@ -0,0 +1,43 @@ +import Link from '@/core/components/elements/Link/Link' +import Image from 'next/image' +import { bannerApi } from '@/api/bannerApi'; +import useDevice from '@/core/hooks/useDevice' +const { useQuery } = require('react-query') +const BannerSection = () => { + const promotionProgram = useQuery('promotionProgram', bannerApi({ type: 'banner-promotion' })); + const { isMobile, isDesktop } = useDevice() + + return ( + <div className='px-4 sm:px-0'> + <div className='flex justify-between items-center mb-4 '> + <div className='font-semibold sm:text-h-lg'>Promo Tersedia</div> + {isDesktop && ( + <Link href='/shop/promo' className='!text-red-500 font-semibold'> + Lihat Semua + </Link> + )} + </div> + {promotionProgram.data && + promotionProgram.data?.length > 0 && ( + <div className='grid grid-cols-3 sm:grid-cols-3 gap-4 rounded-md'> + {promotionProgram.data?.map((banner) => ( + <Link key={banner.id} href={banner.url}> + <Image + width={439} + height={150} + quality={100} + src={banner.image} + alt={banner.name} + className='h-auto w-full rounded hover:scale-105 transition duration-500 ease-in-out' + /> + </Link> + ))} + </div> + + )} + </div> + + ) +} + +export default BannerSection |
