From 9c2b36fb15511b9f38492e133125a8b766c58a19 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 30 Jan 2024 13:51:19 +0700 Subject: Update product similar section --- .../modules/product-detail/components/ProductDetail.tsx | 5 ++++- .../modules/product-detail/components/SimilarBottom.tsx | 12 ++++++++++-- .../modules/product-detail/components/SimilarSide.tsx | 14 ++++++++------ .../modules/product-detail/styles/side-similar.module.css | 3 --- 4 files changed, 22 insertions(+), 12 deletions(-) delete mode 100644 src-migrate/modules/product-detail/styles/side-similar.module.css (limited to 'src-migrate') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index 80f43aea..2bd3c901 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -23,6 +23,7 @@ import SimilarBottom from './SimilarBottom' import PriceAction from './PriceAction' import ProductPromoSection from '~/modules/product-promo/components/Section' import Breadcrumb from './Breadcrumb' +import { LazyLoadComponent } from 'react-lazy-load-image-component' type Props = { product: IProductDetail @@ -166,7 +167,9 @@ const ProductDetail = ({ product }: Props) => {
- + + +
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 ; + return ( + + + + ); } export default SimilarBottom \ No newline at end of file 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 ( -
+ {products.map((product) => ( { layout='horizontal' /> ))} -
+ ) } diff --git a/src-migrate/modules/product-detail/styles/side-similar.module.css b/src-migrate/modules/product-detail/styles/side-similar.module.css deleted file mode 100644 index 08692efa..00000000 --- a/src-migrate/modules/product-detail/styles/side-similar.module.css +++ /dev/null @@ -1,3 +0,0 @@ -.wrapper { - @apply max-h-[500px] overflow-auto grid grid-cols-1 gap-y-4 divide-y divide-gray-300 border border-gray-300 rounded-lg; -} -- cgit v1.2.3 From 0550b0dbe9b8e369cfe211b78ab0de49a6e1f49d Mon Sep 17 00:00:00 2001 From: Rafi Zadanly 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') 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