Skip to content

Commit

Permalink
fix: add disabled button in amount validation
Browse files Browse the repository at this point in the history
  • Loading branch information
HoreKk committed Nov 6, 2024
1 parent f1e250f commit be7b954
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions webapp/src/components/modals/ObizOrderProcessModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,32 @@ const ObizOfferVariableContent = ({
}) => {
switch (step) {
case "amount":
const minimumPrice = article.minimumPrice ?? 0;
const maximumPrice = article.maximumPrice ?? 1000;
const isDisabled =
amount === 0 ||
amount < minimumPrice ||
amount > maximumPrice ||
amount % 1 !== 0;

return (
<>
<Box mt={10}>
<DiscountAmountBlock
discount={article.reductionPercentage}
amount={amount}
setAmount={setAmount}
minAmount={article.minimumPrice || 0}
maxAmount={article.maximumPrice || 1000}
minAmount={minimumPrice}
maxAmount={maximumPrice}
/>
</Box>
<Button mt="auto" mb={24} onClick={() => setStep("summary")} w="full">
<Button
mt="auto"
mb={24}
onClick={() => setStep("summary")}
w="full"
isDisabled={isDisabled}
>
Acheter mon bon
</Button>
</>
Expand Down

0 comments on commit be7b954

Please sign in to comment.