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/SimilarBottom.tsx     | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 src-migrate/modules/product-detail/components/SimilarBottom.tsx

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

diff --git a/src-migrate/modules/product-detail/components/SimilarBottom.tsx b/src-migrate/modules/product-detail/components/SimilarBottom.tsx
new file mode 100644
index 00000000..9a12a6ef
--- /dev/null
+++ b/src-migrate/modules/product-detail/components/SimilarBottom.tsx
@@ -0,0 +1,21 @@
+import React from 'react'
+import useProductSimilar from '~/modules/product-similar/hooks/useProductSimilar'
+import ProductSlider from '~/modules/product-slider'
+import { IProductDetail } from '~/types/product'
+
+type Props = {
+  product: IProductDetail
+}
+
+const SimilarBottom = ({ product }: Props) => {
+  const productSimilar = useProductSimilar({
+    name: product.name,
+    except: { productId: product.id }
+  })
+
+  const products = productSimilar.data?.products || []
+
+  return <ProductSlider products={products} productLayout='vertical' />;
+}
+
+export default SimilarBottom
\ 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/SimilarBottom.tsx      | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

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

diff --git a/src-migrate/modules/product-detail/components/SimilarBottom.tsx b/src-migrate/modules/product-detail/components/SimilarBottom.tsx
index 9a12a6ef..40d4dd82 100644
--- a/src-migrate/modules/product-detail/components/SimilarBottom.tsx
+++ b/src-migrate/modules/product-detail/components/SimilarBottom.tsx
@@ -1,4 +1,4 @@
-import React from 'react'
+import { Skeleton } from '@chakra-ui/react'
 import useProductSimilar from '~/modules/product-similar/hooks/useProductSimilar'
 import ProductSlider from '~/modules/product-slider'
 import { IProductDetail } from '~/types/product'
@@ -15,7 +15,15 @@ const SimilarBottom = ({ product }: Props) => {
 
   const products = productSimilar.data?.products || []
 
-  return <ProductSlider products={products} productLayout='vertical' />;
+  return (
+    <Skeleton
+      isLoaded={!productSimilar.isLoading}
+      rounded='lg'
+      className='h-[350px]'
+    >
+      <ProductSlider products={products} productLayout='vertical' />
+    </Skeleton>
+  );
 }
 
 export default SimilarBottom
\ No newline at end of file
-- 
cgit v1.2.3

