From 92c2a229d9c9b510d71b928978872a8b107e9d5a Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 11 Apr 2023 09:47:25 +0700 Subject: Documentation and refactor code --- .../product/components/Product/ProductMobile.jsx | 8 +++++--- src/lib/product/components/ProductFilter.jsx | 22 ++++------------------ src/lib/product/components/ProductSearch.jsx | 14 ++++++++------ src/lib/product/components/ProductSlider.jsx | 10 ++-------- 4 files changed, 19 insertions(+), 35 deletions(-) (limited to 'src/lib/product/components') diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index 19b4c4b2..1194419e 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -130,9 +130,11 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {

{activeVariant?.name}

- {product.variants.length > 1 && activeVariant.price.priceDiscount > 0 && !selectedVariant && ( -
Harga mulai dari:
- )} + {product.variants.length > 1 && + activeVariant.price.priceDiscount > 0 && + !selectedVariant && ( +
Harga mulai dari:
+ )} {activeVariant?.price?.discountPercentage > 0 && (
diff --git a/src/lib/product/components/ProductFilter.jsx b/src/lib/product/components/ProductFilter.jsx index be1edd18..34357526 100644 --- a/src/lib/product/components/ProductFilter.jsx +++ b/src/lib/product/components/ProductFilter.jsx @@ -35,11 +35,7 @@ const ProductFilter = ({ active, close, brands, categories, prefixUrl, defaultBr } return ( - +
{!defaultBrand && (
@@ -52,10 +48,7 @@ const ProductFilter = ({ active, close, brands, categories, prefixUrl, defaultBr > {brands.map((brand, index) => ( - ))} @@ -72,10 +65,7 @@ const ProductFilter = ({ active, close, brands, categories, prefixUrl, defaultBr > {categories.map((category, index) => ( - ))} @@ -117,11 +107,7 @@ const ProductFilter = ({ active, close, brands, categories, prefixUrl, defaultBr />
-
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index 0010a88a..81e7948b 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -26,13 +26,15 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { ) const productStart = productSearch.data?.responseHeader.params.start const productRows = productSearch.data?.responseHeader.params.rows - const productFound = productSearch.data?.response.numFound - - const brands = productSearch.data?.facetCounts?.facetFields?.manufactureName?.filter((value, index) => { - if (index % 2 === 0) { - return true + const productFound = productSearch.data?.response.numFound + + const brands = productSearch.data?.facetCounts?.facetFields?.manufactureName?.filter( + (value, index) => { + if (index % 2 === 0) { + return true + } } - }) + ) const categories = productSearch.data?.facetCounts?.facetFields?.categoryName?.filter( (value, index) => { if (index % 2 === 0) { diff --git a/src/lib/product/components/ProductSlider.jsx b/src/lib/product/components/ProductSlider.jsx index ed7db486..c8bd3a82 100644 --- a/src/lib/product/components/ProductSlider.jsx +++ b/src/lib/product/components/ProductSlider.jsx @@ -44,18 +44,12 @@ const ProductSlider = ({ products, simpleTitle = false, bannerMode = false }) => > {bannerMode && ( - + )} {products?.products?.map((product, index) => ( - + ))} -- cgit v1.2.3