From 367bf6f382392774680abcf4a5ca4b4d03915650 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 8 Jul 2024 14:31:45 +0700
Subject: <iman> update mobile view

---
 src-migrate/modules/promo/components/Voucher.tsx | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

(limited to 'src-migrate/modules/promo/components/Voucher.tsx')

diff --git a/src-migrate/modules/promo/components/Voucher.tsx b/src-migrate/modules/promo/components/Voucher.tsx
index 14d3c301..397134e8 100644
--- a/src-migrate/modules/promo/components/Voucher.tsx
+++ b/src-migrate/modules/promo/components/Voucher.tsx
@@ -5,25 +5,27 @@ import { getVoucher } from '~/services/voucher'
 import style from '../styles/voucher.module.css'
 import Image from 'next/image'
 import { useToast } from '@chakra-ui/react'
+import useDevice from '@/core/hooks/useDevice';
 
-const swiperVoucher: SwiperProps = {
-  autoplay: {
-    delay: 6000,
-    disableOnInteraction: false
-  },
-  loop: false,
-  className: 'h-[160px] w-full',
-  slidesPerView: 3,
-  spaceBetween: 16
-}
 
 const Voucher = () => {
+  const { isMobile } = useDevice();
   const toast = useToast();
   const voucherQuery = useQuery({
     queryKey: ['voucher.all-voucher'],
     queryFn: getVoucher
   })
-
+  
+  const swiperVoucher: SwiperProps = {
+    autoplay: {
+      delay: 6000,
+      disableOnInteraction: false
+    },
+    loop: false,
+    className: 'h-[160px] w-full',
+    slidesPerView: isMobile ? 1.2 : 3,
+    spaceBetween: 16
+  }
   const vouchers = useMemo(() => voucherQuery.data || [], [voucherQuery.data]);
 
   const copyText = (text: string) => {
-- 
cgit v1.2.3

