From f62b2345f463695ef0f8f79830cd76b6e0332821 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Sat, 13 Jan 2024 10:35:22 +0700
Subject: Refactor src migrate folder

---
 .../product-detail/components/SimilarSide.tsx      | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 src-migrate/modules/product-detail/components/SimilarSide.tsx

(limited to 'src-migrate/modules/product-detail/components/SimilarSide.tsx')

diff --git a/src-migrate/modules/product-detail/components/SimilarSide.tsx b/src-migrate/modules/product-detail/components/SimilarSide.tsx
new file mode 100644
index 00000000..646a1c51
--- /dev/null
+++ b/src-migrate/modules/product-detail/components/SimilarSide.tsx
@@ -0,0 +1,34 @@
+import style from '../styles/side-similar.module.css'
+
+import React from 'react'
+
+import ProductCard from '~/modules/product-card'
+import useProductSimilar from '~/modules/product-similar/hooks/useProductSimilar'
+import { IProductDetail } from '~/types/product'
+
+type Props = {
+  product: IProductDetail
+}
+
+const SimilarSide = ({ product }: Props) => {
+  const productSimilar = useProductSimilar({
+    name: product.name,
+    except: { productId: product.id, manufactureId: product.manufacture.id },
+  })
+
+  const products = productSimilar.data?.products || []
+
+  return (
+    <div className={style['wrapper']}>
+      {products.map((product) => (
+        <ProductCard
+          key={product.id}
+          product={product}
+          layout='horizontal'
+        />
+      ))}
+    </div>
+  )
+}
+
+export default SimilarSide
\ No newline at end of file
-- 
cgit v1.2.3


From 9c2b36fb15511b9f38492e133125a8b766c58a19 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Tue, 30 Jan 2024 13:51:19 +0700
Subject: Update product similar section

---
 .../modules/product-detail/components/SimilarSide.tsx      | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'src-migrate/modules/product-detail/components/SimilarSide.tsx')

diff --git a/src-migrate/modules/product-detail/components/SimilarSide.tsx b/src-migrate/modules/product-detail/components/SimilarSide.tsx
index 646a1c51..2ba8fa21 100644
--- a/src-migrate/modules/product-detail/components/SimilarSide.tsx
+++ b/src-migrate/modules/product-detail/components/SimilarSide.tsx
@@ -1,6 +1,4 @@
-import style from '../styles/side-similar.module.css'
-
-import React from 'react'
+import { Skeleton } from '@chakra-ui/react'
 
 import ProductCard from '~/modules/product-card'
 import useProductSimilar from '~/modules/product-similar/hooks/useProductSimilar'
@@ -13,13 +11,17 @@ type Props = {
 const SimilarSide = ({ product }: Props) => {
   const productSimilar = useProductSimilar({
     name: product.name,
-    except: { productId: product.id, manufactureId: product.manufacture.id },
+    except: { productId: product.id },
   })
 
   const products = productSimilar.data?.products || []
 
   return (
-    <div className={style['wrapper']}>
+    <Skeleton
+      isLoaded={!productSimilar.isLoading}
+      className="h-[500px] overflow-auto grid grid-cols-1 gap-y-4 divide-y divide-gray-300 border border-gray-300 rounded-lg"
+      rounded='lg'
+    >
       {products.map((product) => (
         <ProductCard
           key={product.id}
@@ -27,7 +29,7 @@ const SimilarSide = ({ product }: Props) => {
           layout='horizontal'
         />
       ))}
-    </div>
+    </Skeleton>
   )
 }
 
-- 
cgit v1.2.3


From 0550b0dbe9b8e369cfe211b78ab0de49a6e1f49d Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Tue, 30 Jan 2024 15:54:28 +0700
Subject: Add except product similar

---
 src-migrate/modules/product-detail/components/SimilarSide.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src-migrate/modules/product-detail/components/SimilarSide.tsx')

diff --git a/src-migrate/modules/product-detail/components/SimilarSide.tsx b/src-migrate/modules/product-detail/components/SimilarSide.tsx
index 2ba8fa21..d70a314d 100644
--- a/src-migrate/modules/product-detail/components/SimilarSide.tsx
+++ b/src-migrate/modules/product-detail/components/SimilarSide.tsx
@@ -11,7 +11,7 @@ type Props = {
 const SimilarSide = ({ product }: Props) => {
   const productSimilar = useProductSimilar({
     name: product.name,
-    except: { productId: product.id },
+    except: { productId: product.id, manufactureId: product.manufacture.id },
   })
 
   const products = productSimilar.data?.products || []
-- 
cgit v1.2.3

