summaryrefslogtreecommitdiff
path: root/src/lib/home/components/PromotionProgram.jsx
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2024-07-02 15:37:19 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2024-07-02 15:37:19 +0700
commit5724e3b75c9bcb568d123fe86135205df1bb1c76 (patch)
tree6ae46a1d8408d181d01d9569f52e86f5ccc7d76a /src/lib/home/components/PromotionProgram.jsx
parentf287fc062c4ceb5039b5ca946da2e6854c27b007 (diff)
parentf7b024585b70f1bd600ba5e0d26368c532ac9723 (diff)
Merge branch 'release' into feature/step_approval
# Conflicts: # src-migrate/modules/product-detail/components/PriceAction.tsx # src/lib/transaction/components/Transaction.jsx # src/pages/index.jsx
Diffstat (limited to 'src/lib/home/components/PromotionProgram.jsx')
-rw-r--r--src/lib/home/components/PromotionProgram.jsx66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx
new file mode 100644
index 00000000..b204df8e
--- /dev/null
+++ b/src/lib/home/components/PromotionProgram.jsx
@@ -0,0 +1,66 @@
+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 { 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 '>
+ <div className='font-semibold sm:text-h-lg'>Promo Tersedia</div>
+ {isDesktop && (
+ <div></div>
+ // <Link href='/shop/promo' className='!text-red-500 font-semibold'>
+ // Lihat Semua
+ // </Link>
+ )}
+ </div>
+ {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) => (
+ <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 hover:scale-105 transition duration-500 ease-in-out'
+ />
+ </Link>
+ ))}
+ </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>
+
+ )
+}
+
+export default BannerSection