summaryrefslogtreecommitdiff
path: root/src-migrate/modules/product-detail/components/PriceAction.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx')
-rw-r--r--src-migrate/modules/product-detail/components/PriceAction.tsx26
1 files changed, 17 insertions, 9 deletions
diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx
index a329d2cc..510dd6a9 100644
--- a/src-migrate/modules/product-detail/components/PriceAction.tsx
+++ b/src-migrate/modules/product-detail/components/PriceAction.tsx
@@ -78,6 +78,7 @@ const PriceAction = ({ product }: Props) => {
const validJsonString = stringVoucher.replace(/'/g, '"');
voucherPastiHemat = JSON.parse(validJsonString);
}
+ const hasPrice = Number(product?.lowest_price?.price) > 0;
return (
<div
@@ -145,7 +146,7 @@ const PriceAction = ({ product }: Props) => {
</>
)}
- {!!activePrice && activePrice.price === 0 && (
+ {/* {!!activePrice && activePrice.price === 0 && (
<span>
Hubungi kami untuk dapatkan harga terbaik,{' '}
<Link
@@ -156,7 +157,7 @@ const PriceAction = ({ product }: Props) => {
klik disini
</Link>
</span>
- )}
+ )} */}
<DesktopView>
<div className='h-4' />
@@ -165,27 +166,32 @@ const PriceAction = ({ product }: Props) => {
<div className='relative flex items-center'>
<button
type='button'
- className='absolute left-0 px-2 py-1 h-full text-gray-500'
+ className='absolute left-0 px-2 py-1 h-full text-gray-500 disabled:opacity-40'
onClick={() =>
setQuantityInput(String(Math.max(1, Number(quantityInput) - 1)))
}
+ disabled={!hasPrice}
>
-
</button>
+
<input
type='number'
id='quantity'
min={1}
value={quantityInput}
onChange={(e) => setQuantityInput(e.target.value)}
- className={style['quantity-input']}
+ className={`${style['quantity-input']} disabled:bg-gray-100 disabled:text-gray-400`}
+ disabled={!hasPrice}
/>
+
<button
type='button'
- className='absolute right-0 px-2 py-1 h-full text-gray-500'
+ className='absolute right-0 px-2 py-1 h-full text-gray-500 disabled:opacity-40'
onClick={() =>
setQuantityInput(String(Number(quantityInput) + 1))
}
+ disabled={!hasPrice}
>
+
</button>
@@ -196,9 +202,11 @@ const PriceAction = ({ product }: Props) => {
<Skeleton
isLoaded={sla}
h='21px'
- className={sla?.qty < 10 ? 'text-red-600 font-medium' : ''}
+ className={
+ !hasPrice || sla?.qty < 10 ? 'text-red-600 font-medium' : ''
+ }
>
- Stock : {sla?.qty}{' '}
+ Stock : {hasPrice ? sla?.qty : 'Habis'}
</Skeleton>
</div>
@@ -219,9 +227,9 @@ const PriceAction = ({ product }: Props) => {
)}
</div>
</div>
- <span className='text-[12px] text-red-500 italic'>
+ {/* <span className='text-[12px] text-red-500 italic'>
* {qtyPickUp} barang bisa di pickup
- </span>
+ </span> */}
</DesktopView>
{/* ===== MOBILE: grid kiri-kanan, kanan hanya qty ===== */}