fixed
This commit is contained in:
@@ -199,12 +199,12 @@ const ProductDetail = () => {
|
||||
|
||||
const handleDecrease = () => {
|
||||
setQuantity((q) => {
|
||||
const base = q === '' || q === '.' || q === ',' ? 0 : Number(q);
|
||||
const base = q === '' || q === '.' || q === ',' ? MIN_QTY : Number(q);
|
||||
let next = base - STEP;
|
||||
|
||||
if (isGram) next = Math.floor(next / STEP) * STEP;
|
||||
|
||||
return next <= MIN_QTY ? MIN_QTY : next;
|
||||
return Math.max(next, MIN_QTY);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -256,7 +256,8 @@ const ProductDetail = () => {
|
||||
<div className="flex items-center gap-4">
|
||||
<button
|
||||
onClick={handleDecrease}
|
||||
className="p-2 border rounded hover:bg-gray-50"
|
||||
disabled={numericQty <= MIN_QTY}
|
||||
className="p-2 border rounded hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed"
|
||||
>
|
||||
<Minus />
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user