From 637c22f1886cecf7307ced88dc951134d466a3fa Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Mon, 19 Jun 2023 15:46:03 +0700 Subject: checkout --- .../product/components/Product/ProductDesktop.jsx | 47 ++++++++++++++++++---- .../product/components/Product/ProductMobile.jsx | 7 ++-- 2 files changed, 44 insertions(+), 10 deletions(-) (limited to 'src/lib/product/components') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index f1a001a6..d9c95327 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -1,4 +1,5 @@ import Image from '@/core/components/elements/Image/Image' +import ImageNext from 'next/image' import Link from '@/core/components/elements/Link/Link' import DesktopView from '@/core/components/views/DesktopView' import currencyFormat from '@/core/utils/currencyFormat' @@ -58,7 +59,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { } const handleAddToCart = (variantId) => { - if(!auth) { + if (!auth) { router.push(`/login?next=/shop/product/${slug}`) return } @@ -165,11 +166,13 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { )} -
-
- + {product.variants.length <= 1 && ( +
+
+ +
-
+ )}
@@ -328,7 +331,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { - {product.variants.map((variant) => ( + {product.variants.map((variant, index) => ( {variant.code} {variant.attributes.join(', ') || '-'} @@ -367,6 +370,27 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { /> + {index == 0 ? ( + setPromotionType(true)} + className='cursor-pointer' + > + ) : ( +
+ setPromotionType(true)} + className='cursor-pointer' + > +
+ )}