summaryrefslogtreecommitdiff
path: root/src/lib/product/components/Product/ProductMobileVariant.jsx
diff options
context:
space:
mode:
authorFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2025-12-08 09:14:28 +0700
committerFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2025-12-08 09:14:28 +0700
commit5678b10ef5100665a891e53177a7896f7d9cd9ca (patch)
tree0213841842f7df928f72f7d9be2b2ed05edf3b29 /src/lib/product/components/Product/ProductMobileVariant.jsx
parent43b2ce4d59c153655eb9b7a2190b83050fd48855 (diff)
parent3ea1f49b036bfa352106142866f454bde2c61e02 (diff)
(andri) fix
Diffstat (limited to 'src/lib/product/components/Product/ProductMobileVariant.jsx')
-rw-r--r--src/lib/product/components/Product/ProductMobileVariant.jsx9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx
index 0f4953df..9d375deb 100644
--- a/src/lib/product/components/Product/ProductMobileVariant.jsx
+++ b/src/lib/product/components/Product/ProductMobileVariant.jsx
@@ -181,6 +181,11 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
return Math.floor(Math.random() * 100) + 1;
});
+ const getImageVariant = (img) => {
+ if (!img || img.trim() === '') return '/images/noimage.jpeg';
+ return `${img}?variant=True`;
+ };
+
return (
<MobileView>
<div className='relative'>
@@ -338,7 +343,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
</div>
<Image
- src={product.image + '?variant=True'}
+ src={getImageVariant(product?.image)}
alt={product.name}
className='h-72 object-contain object-center w-full border-b border-gray_r-4'
/>
@@ -532,7 +537,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
<div className='flex mt-4'>
<div className='w-[15%]'>
<Image
- src={product.image + '?variant=True'}
+ src={getImageVariant(product?.image)}
alt={product.name}
className='h-20 object-contain object-center w-full border border-gray_r-4'
/>