From f23d32a4b8402904e8daa7b906c03a64104ed253 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 30 Mar 2023 13:23:33 +0700 Subject: product desktop variant --- .../product/components/Product/ProductDesktop.jsx | 46 ++++++++-------------- 1 file changed, 17 insertions(+), 29 deletions(-) (limited to 'src/lib/product') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 0866bffa..c7554242 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -8,7 +8,6 @@ import LazyLoad from 'react-lazy-load' import ProductSimilar from '../ProductSimilar' import { toast } from 'react-hot-toast' import { updateItemCart } from '@/core/utils/cart' -import useVariantPrice from '@/lib/variant/hooks/useVariantPrice' import useProductPrice from '../../hooks/useProductPrice' import PriceSkeleton from '@/core/components/elements/Skeleton/PriceSkeleton' import { useRouter } from 'next/router' @@ -193,7 +192,23 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { {variant.code} {variant.attributes.join(', ') || '-'} - + {variant.price.discountPercentage > 0 && variant.price.priceDiscount > 0 && ( + <> +
+ {currencyFormat(variant.price.price)} +
{' '} + + )} +
+ {variant.price.priceDiscount > 0 ? ( + currencyFormat(variant.price.priceDiscount) + ) : ( + + Call for price + + )} +
+ {/* */} { ) } -const VariantPrice = ({ id }) => { - const { variantPrice } = useVariantPrice({ id }) - - if (variantPrice.isLoading) return - - return ( - <> - {variantPrice?.data?.discount > 0 && variantPrice?.data?.priceExcludeAfterDiscount > 0 && ( - <> -
- {currencyFormat(variantPrice?.data?.priceExclude)} -
{' '} - - )} -
- {variantPrice?.data?.priceExcludeAfterDiscount > 0 ? ( - currencyFormat(variantPrice?.data?.priceExcludeAfterDiscount) - ) : ( - - Call for price - - )} -
- - ) -} - const informationTabOptions = [ { value: 'description', label: 'Deskripsi' }, { value: 'information', label: 'Info Penting' } -- cgit v1.2.3