From 1ef538546c0bdd9351baaed90b837f399584b460 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Mon, 13 Mar 2023 16:20:18 +0700
Subject: category, brand, product popular, product category in desktop home
 page

---
 src/lib/home/components/PopularProduct.jsx | 51 +++++++++++++++++++++++-------
 1 file changed, 39 insertions(+), 12 deletions(-)

(limited to 'src/lib/home/components/PopularProduct.jsx')

diff --git a/src/lib/home/components/PopularProduct.jsx b/src/lib/home/components/PopularProduct.jsx
index d23275f7..78dc5d49 100644
--- a/src/lib/home/components/PopularProduct.jsx
+++ b/src/lib/home/components/PopularProduct.jsx
@@ -1,23 +1,50 @@
-import { Swiper, SwiperSlide } from 'swiper/react'
 import usePopularProduct from '../hooks/usePopularProduct'
-import ProductCard from '@/lib/product/components/ProductCard'
 import PopularProductSkeleton from './Skeleton/PopularProductSkeleton'
 import ProductSlider from '@/lib/product/components/ProductSlider'
+import DesktopView from '@/core/components/views/DesktopView'
+import MobileView from '@/core/components/views/MobileView'
+import ProductCard from '@/lib/product/components/ProductCard'
 
 const PopularProduct = () => {
   const { popularProducts } = usePopularProduct()
 
   return (
-    <div className='px-4'>
-      <div className='font-medium mb-4'>Produk Populer</div>
-      {popularProducts.isLoading && <PopularProductSkeleton />}
-      {!popularProducts.isLoading && (
-        <ProductSlider
-          products={popularProducts.data}
-          simpleTitle
-        />
-      )}
-    </div>
+    <>
+      <MobileView>
+        <div className='px-4'>
+          <div className='font-medium mb-4'>Produk Banyak Dilihat</div>
+          {popularProducts.isLoading && <PopularProductSkeleton />}
+          {!popularProducts.isLoading && (
+            <ProductSlider
+              products={popularProducts.data}
+              simpleTitle
+            />
+          )}
+        </div>
+      </MobileView>
+
+      <DesktopView>
+        <div className='border border-gray_r-6 h-full overflow-auto'>
+          <div className='font-medium text-center p-4 bg-gray_r-1 border-b border-gray_r-6 sticky top-0 z-10'>
+            Produk Banyak Dilihat
+          </div>
+          <div className='h-full divide-y divide-gray_r-6'>
+            {popularProducts.data &&
+              popularProducts.data.products.map((product) => (
+                <div
+                  className='py-2'
+                  key={product.id}
+                >
+                  <ProductCard
+                    product={product}
+                    variant='horizontal'
+                  />
+                </div>
+              ))}
+          </div>
+        </div>
+      </DesktopView>
+    </>
   )
 }
 
-- 
cgit v1.2.3

