From 1ef538546c0bdd9351baaed90b837f399584b460 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 13 Mar 2023 16:20:18 +0700 Subject: category, brand, product popular, product category in desktop home page --- src/lib/home/components/CategoryHome.jsx | 2 +- src/lib/home/components/PopularProduct.jsx | 51 +++++++++++++++++++++++------- src/lib/home/components/PreferredBrand.jsx | 21 +++++++++--- 3 files changed, 57 insertions(+), 17 deletions(-) (limited to 'src/lib/home/components') diff --git a/src/lib/home/components/CategoryHome.jsx b/src/lib/home/components/CategoryHome.jsx index ac43e2bc..05f0ca28 100644 --- a/src/lib/home/components/CategoryHome.jsx +++ b/src/lib/home/components/CategoryHome.jsx @@ -6,7 +6,7 @@ const CategoryHome = ({ id }) => { const { categoryHome } = useCategoryHome({ id }) return ( -
+
{categoryHome.data ? ( { const { popularProducts } = usePopularProduct() return ( -
-
Produk Populer
- {popularProducts.isLoading && } - {!popularProducts.isLoading && ( - - )} -
+ <> + +
+
Produk Banyak Dilihat
+ {popularProducts.isLoading && } + {!popularProducts.isLoading && ( + + )} +
+
+ + +
+
+ Produk Banyak Dilihat +
+
+ {popularProducts.data && + popularProducts.data.products.map((product) => ( +
+ +
+ ))} +
+
+
+ ) } diff --git a/src/lib/home/components/PreferredBrand.jsx b/src/lib/home/components/PreferredBrand.jsx index 3df3cdb7..7edd0730 100644 --- a/src/lib/home/components/PreferredBrand.jsx +++ b/src/lib/home/components/PreferredBrand.jsx @@ -2,18 +2,31 @@ import { Swiper, SwiperSlide } from 'swiper/react' import usePreferredBrand from '../hooks/usePreferredBrand' import PreferredBrandSkeleton from './Skeleton/PreferredBrandSkeleton' import BrandCard from '@/lib/brand/components/BrandCard' +import useDevice from '@/core/hooks/useDevice' +import Link from '@/core/components/elements/Link/Link' const PreferredBrand = () => { const { preferredBrands } = usePreferredBrand() + const { isMobile, isDesktop } = useDevice() return ( -
-
Brand Pilihan
+
+
+
Brand Pilihan
+ {isDesktop && ( + + Lihat Semua + + )} +
{preferredBrands.isLoading && } {!preferredBrands.isLoading && ( {preferredBrands.data?.manufactures.map((brand) => ( -- cgit v1.2.3