diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-05-19 16:31:42 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-05-19 16:31:42 +0700 |
| commit | baf0447595815be64312ac836e5f8bb403e4dcfc (patch) | |
| tree | ee3b55ca81350e65ad5eb76f3b63f88a04fdd856 /src/lib/home/components/BannerSection.jsx | |
| parent | af35f7c31c65b6fb42c67424674f1f8acd68a5a1 (diff) | |
banner section and product category banner url
Diffstat (limited to 'src/lib/home/components/BannerSection.jsx')
| -rw-r--r-- | src/lib/home/components/BannerSection.jsx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/home/components/BannerSection.jsx b/src/lib/home/components/BannerSection.jsx new file mode 100644 index 00000000..8459d08e --- /dev/null +++ b/src/lib/home/components/BannerSection.jsx @@ -0,0 +1,30 @@ +import Link from '@/core/components/elements/Link/Link' +import Image from 'next/image' + +const { useQuery } = require('react-query') +const { default: bannerSectionApi } = require('../api/bannerSectionApi') + +const BannerSection = () => { + const fetchBannerSection = async () => await bannerSectionApi() + const bannerSection = useQuery('bannerSection', fetchBannerSection) + + return ( + bannerSection.data && ( + <div className='grid grid-cols-1 sm:grid-cols-2 gap-4'> + {bannerSection.data?.map((banner) => ( + <Link key={banner.id} href={banner.url}> + <Image + width={512} + height={256} + src={banner.image} + alt={banner.name} + className='h-auto w-full rounded' + /> + </Link> + ))} + </div> + ) + ) +} + +export default BannerSection |
