summaryrefslogtreecommitdiff
path: root/src/lib/home/components
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-06-28 16:47:06 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-06-28 16:47:06 +0700
commitca0faeb73b521a40a2e96b2e7b724b839db6aa57 (patch)
treec77c6e9ac11da28cebc5e8f7d830ddd57df0741c /src/lib/home/components
parent1455ce5887a3d03597192118ba84d3c27f165b12 (diff)
<iman> update mobile view
Diffstat (limited to 'src/lib/home/components')
-rw-r--r--src/lib/home/components/PromotionProgram.jsx29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx
index c2779fd2..b204df8e 100644
--- a/src/lib/home/components/PromotionProgram.jsx
+++ b/src/lib/home/components/PromotionProgram.jsx
@@ -2,12 +2,12 @@ import Link from '@/core/components/elements/Link/Link'
import Image from 'next/image'
import { bannerApi } from '@/api/bannerApi';
import useDevice from '@/core/hooks/useDevice'
-import { div } from 'lodash-contrib';
+import { Swiper, SwiperSlide } from 'swiper/react';
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 '>
@@ -19,7 +19,7 @@ const BannerSection = () => {
// </Link>
)}
</div>
- {promotionProgram.data &&
+ {isDesktop && (promotionProgram.data &&
promotionProgram.data?.length > 0 && (
<div className='grid grid-cols-3 sm:grid-cols-3 gap-4 rounded-md'>
{promotionProgram.data?.map((banner) => (
@@ -36,7 +36,28 @@ const BannerSection = () => {
))}
</div>
- )}
+ ))}
+
+{isMobile && (
+
+ <Swiper slidesPerView={1.1} spaceBetween={8} freeMode>
+ {promotionProgram.data?.map((banner) => (
+ <SwiperSlide key={banner.id}>
+ <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 '
+ />
+ </Link>
+ </SwiperSlide>
+ ))}
+ </Swiper>
+
+ )}
</div>
)