This commit is contained in:
Samandar Turgunboyev
2026-02-25 11:16:40 +05:00
parent c7ac5ad861
commit 4fd458075c

View File

@@ -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>