summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-07-17 11:07:00 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-07-17 11:07:00 +0700
commit60060b517651e1122a638a3f592017879a0e9e63 (patch)
treed3d7cc24eb59fdeaac08c08d2a4b2c1d553db7d9
parent937013e8bf9f176c18a31d94205b9116d2a02224 (diff)
<iman> update all promotion
-rw-r--r--src-migrate/modules/promo/components/FlashSale.tsx2
-rw-r--r--src-migrate/modules/promo/components/PromoList.tsx (renamed from src-migrate/modules/promo/components/PromoList.jsx)39
-rw-r--r--src/core/components/elements/Navbar/NavbarDesktop.jsx37
3 files changed, 52 insertions, 26 deletions
diff --git a/src-migrate/modules/promo/components/FlashSale.tsx b/src-migrate/modules/promo/components/FlashSale.tsx
index 16cb7647..05bf1e11 100644
--- a/src-migrate/modules/promo/components/FlashSale.tsx
+++ b/src-migrate/modules/promo/components/FlashSale.tsx
@@ -12,7 +12,7 @@ const FlashSale = dynamic(
const FlashSalePromo = ()=> {
return(
<>
- <h1 className='text-h-sm md:text-h-lg font-semibold'>Bayar Setengahnya!</h1>
+ <h1 className='h-4'></h1>
<FlashSale/>
</>
)
diff --git a/src-migrate/modules/promo/components/PromoList.jsx b/src-migrate/modules/promo/components/PromoList.tsx
index e6add893..42725034 100644
--- a/src-migrate/modules/promo/components/PromoList.jsx
+++ b/src-migrate/modules/promo/components/PromoList.tsx
@@ -1,16 +1,20 @@
import React, { useEffect, useState } from 'react';
import { Button, Skeleton } from '@chakra-ui/react'
import clsxm from "~/libs/clsxm"
-import ProductPromoCard from '../../../../src-migrate/modules/product-promo/components/Card';
+import ProductPromoCard from '../../product-promo/components/Card';
import { fetchPromoItemsSolr } from '../../../../src/api/promoApi';
import { Swiper, SwiperSlide } from 'swiper/react';
+import SwiperCore, { Navigation, Pagination } from 'swiper';
import useDevice from '@/core/hooks/useDevice';
import LogoSpinner from '../../../../src/core/components/elements/Spinner/LogoSpinner';
import usePromoStore from './promoStore';
-import { ChevronRightIcon } from '@heroicons/react/24/outline';
-import Link from '@/core/components/elements/Link/Link'
+import Link from "next/link"
+import { IPromotion } from '~/types/promotion';
+interface PromoListProps {
+ selectedPromo: string; // Tipe selectedPromo ditetapkan sebagai string
+}
-const PromoList = ({ selectedPromo }) => {
+const PromoList: React.FC<PromoListProps> = ({ selectedPromo }) => {
const {
title,
slug,
@@ -24,7 +28,16 @@ const PromoList = ({ selectedPromo }) => {
setIsLoading,
} = usePromoStore();
- const { isMobile } = useDevice();
+ const { isMobile, isDesktop } = useDevice();
+
+ const swiperBanner = {
+ modules: [Navigation],
+ className: 'h-[400px] w-full',
+ slidesPerView: isMobile ? 1.1 : 3.25,
+ spaceBetween: 10,
+ navigation:isMobile? true : false,
+ allowTouchMove:isMobile? false : true,
+ };
useEffect(() => {
if (selectedPromo === 'Bundling') {
@@ -96,11 +109,23 @@ const PromoList = ({ selectedPromo }) => {
"min-h-[340px]": promoData[0] && promoData?.length > 0
})}
>
- {promoData?.map((promotion) => (
+ {isDesktop && (
+ <Swiper {...swiperBanner}>
+ {promoData?.map((promotion: IPromotion) => (
+ <SwiperSlide key={promotion.id}>
+ <div className="min-w-36 max-w-[400px] mb-[20px] sm:w-full md:w-full lg:w-full xl:w-full">
+ <ProductPromoCard promotion={promotion} />
+ </div>
+ </SwiperSlide>
+ ))}
+ </Swiper>
+ )}
+ {isMobile && (promoData?.map((promotion: IPromotion) => (
<div key={promotion.id} className="min-w-[400px] max-w-[400px]">
<ProductPromoCard promotion={promotion} />
</div>
- ))}
+ )))}
+
</Skeleton>
)}
</div>
diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx
index 181eef0d..66dc730c 100644
--- a/src/core/components/elements/Navbar/NavbarDesktop.jsx
+++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx
@@ -170,45 +170,46 @@ const NavbarDesktop = () => {
</div>
</button>
<div className='w-6/12 flex px-1 divide-x divide-gray_r-6'>
- <Link
- href='/shop/promo'
- className={`${
- router.asPath === '/shop/promo' && 'bg-gray_r-3'
- } p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition`}
- // className='p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition'
- target='_blank'
- rel='noreferrer'
- >
- Semua Promo
- </Link>
+ <Link
+ href="/shop/promo"
+ className={`${
+ router.asPath === '/shop/promo' && 'bg-gray_r-3'
+ } p-4 flex-1 flex justify-between items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition group`}
+ target="_blank"
+ rel="noreferrer"
+ >
+ <p className="group-hover:scale-105 group-hover:text-red-500 transition-transform duration-200">Semua Promo</p>
+ <p className="rounded bg-red-500 font-bold text-white text-[10px] w-auto inline-block p-[2px] rotate-12 -translate-y-2 group-hover:scale-105 transition-transform duration-200">NEW!</p>
+ </Link>
+
<Link
href='/shop/brands'
- className={`${
+ className={`${
router.asPath === '/shop/brands' && 'bg-gray_r-3'
- } p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition`}
+ } p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition group`}
target='_blank'
rel='noreferrer'
>
- Semua Brand
+ <p className="group-hover:scale-105 group-hover:text-red-500 transition-transform duration-200">Semua Brand</p>
</Link>
<Link
href='/shop/search?orderBy=stock'
className={`${
router.asPath === '/shop/search?orderBy=stock' &&
'bg-gray_r-3'
- } p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition`}
+ } p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition group`}
target='_blank'
rel='noreferrer'
>
- Ready Stock
+ <p className="group-hover:scale-105 group-hover:text-red-500 transition-transform duration-200">Ready Stock</p>
</Link>
<Link
href='https://blog.indoteknik.com/'
- className='p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition'
+ className='p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition group'
target='_blank'
rel='noreferrer noopener'
>
- Blog Indoteknik
+ <p className="group-hover:scale-105 group-hover:text-red-500 transition-transform duration-200">Blog Indoteknik</p>
</Link>
{/* <Link
href='/video'