From ca0faeb73b521a40a2e96b2e7b724b839db6aa57 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 28 Jun 2024 16:47:06 +0700
Subject: <iman> update mobile view

---
 src/lib/home/components/PromotionProgram.jsx | 29 ++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

(limited to 'src/lib/home/components/PromotionProgram.jsx')

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>
     
   )
-- 
cgit v1.2.3

