summaryrefslogtreecommitdiff
path: root/src-migrate/modules/promo/components/Voucher.tsx
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-07-08 14:31:45 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-07-08 14:31:45 +0700
commit367bf6f382392774680abcf4a5ca4b4d03915650 (patch)
tree46589797fcab3c91afdbc57e824fadf186a5a044 /src-migrate/modules/promo/components/Voucher.tsx
parent595c5cd7b371c61874db47ae42819acca5fc5d16 (diff)
<iman> update mobile view
Diffstat (limited to 'src-migrate/modules/promo/components/Voucher.tsx')
-rw-r--r--src-migrate/modules/promo/components/Voucher.tsx24
1 files changed, 13 insertions, 11 deletions
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) => {