From 266d123ea9a2516913aa6f72d8c5855aea99652c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 29 Aug 2024 15:42:22 +0700 Subject: update navbar category link & change category dynamic to slider --- src/lib/home/components/CategoryDynamic.jsx | 130 ++++++++++++++++------------ 1 file changed, 76 insertions(+), 54 deletions(-) (limited to 'src/lib') diff --git a/src/lib/home/components/CategoryDynamic.jsx b/src/lib/home/components/CategoryDynamic.jsx index b7798a24..7f8a4135 100644 --- a/src/lib/home/components/CategoryDynamic.jsx +++ b/src/lib/home/components/CategoryDynamic.jsx @@ -4,7 +4,12 @@ import NextImage from 'next/image'; import Link from "next/link"; import { createSlug } from '@/core/utils/slug'; import odooApi from '@/core/api/odooApi'; -import { Skeleton} from '@chakra-ui/react' +import { Skeleton } from '@chakra-ui/react'; +import { Swiper, SwiperSlide } from 'swiper/react'; +import 'swiper/css'; +import 'swiper/css/navigation'; +import 'swiper/css/pagination'; +import { Navigation, Pagination, Autoplay } from 'swiper'; const CategoryDynamic = () => { const { categoryManagement } = useCategoryManagement(); @@ -34,6 +39,18 @@ const CategoryDynamic = () => { fetchCategoryData(); }, [categoryManagement.isLoading]); + + const swiperBanner = { + autoplay: { + delay: 6000, + disableOnInteraction: false, + }, + modules: [Pagination, Autoplay], + loop: true, + classNames:'mySwiper', + slidesPerView: 3, + spaceBetween:10, + }; return (
@@ -42,64 +59,69 @@ const CategoryDynamic = () => { return ( -
-
-
{category.name}
- -

{countLevel1} Produk tersedia

-
- Lihat Semua -
-
- {category.categories.map((subCategory) => { - const countLevel2 = subCategoryData[subCategory.idLevel2] || 0; +
+
+
{category.name}
+ +

{countLevel1} Produk tersedia

+
+ Lihat Semua +
+ + {/* Swiper for SubCategories */} + + {category.categories.map((subCategory) => { + const countLevel2 = subCategoryData[subCategory.idLevel2] || 0; - return ( -
-
-
- -
-
{subCategory.name}
- -

- {countLevel2} Produk tersedia -

-
- Lihat Semua -
-
-
- {subCategory.childFrontendIdI.map((childCategory) => ( -
- - -
-
{childCategory.name}
+ return ( + +
+
+
+ +
+
{subCategory.name}
+ +

+ {countLevel2} Produk tersedia +

+
+ Lihat Semua +
+
+
+ {subCategory.childFrontendIdI.map((childCategory) => ( +
+ + +
+
{childCategory.name}
+
+
- + ))}
- ))} +
-
-
- ); - })} + + ); + })} +
-
- + ); })}
-- cgit v1.2.3 From 35c3eaad59dac0f0837dc43d5d4355c7e77803e5 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 29 Aug 2024 16:08:55 +0700 Subject: update mobile view --- src/lib/home/components/CategoryDynamicMobile.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/home/components/CategoryDynamicMobile.jsx b/src/lib/home/components/CategoryDynamicMobile.jsx index c1433a2d..4d2fa0ec 100644 --- a/src/lib/home/components/CategoryDynamicMobile.jsx +++ b/src/lib/home/components/CategoryDynamicMobile.jsx @@ -59,7 +59,7 @@ const CategoryDynamicMobile = () => { alt={index.name} width={30} height={30} - className='object-' + className='' />
{index.name}
@@ -82,6 +82,7 @@ const CategoryDynamicMobile = () => { alt={x.name} width={40} height={40} + className='p-2' />
{x.name}
-- cgit v1.2.3 From 28691cd9eed9ea4480d978ae83a8a9424caf8ef4 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 29 Aug 2024 16:13:51 +0700 Subject: add pagintion --- src/lib/home/components/CategoryDynamic.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/home/components/CategoryDynamic.jsx b/src/lib/home/components/CategoryDynamic.jsx index 7f8a4135..48a60323 100644 --- a/src/lib/home/components/CategoryDynamic.jsx +++ b/src/lib/home/components/CategoryDynamic.jsx @@ -41,15 +41,15 @@ const CategoryDynamic = () => { }, [categoryManagement.isLoading]); const swiperBanner = { - autoplay: { - delay: 6000, - disableOnInteraction: false, - }, - modules: [Pagination, Autoplay], + modules: [Pagination, ], loop: true, classNames:'mySwiper', slidesPerView: 3, spaceBetween:10, + pagination: { + dynamicBullets: true, + clickable: true, + } }; return ( -- cgit v1.2.3