From 11ab19f3a7bf4b5f58a779b02c4bc39e03212628 Mon Sep 17 00:00:00 2001 From: Aryeh Harris Date: Wed, 4 Oct 2023 20:26:12 -0500 Subject: [PATCH] Allow inputting 0 to type decimal --- src/components/Faucet/FaucetRequestButton.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/Faucet/FaucetRequestButton.tsx b/src/components/Faucet/FaucetRequestButton.tsx index a36ec5f..d5f53d2 100644 --- a/src/components/Faucet/FaucetRequestButton.tsx +++ b/src/components/Faucet/FaucetRequestButton.tsx @@ -79,9 +79,12 @@ export default function FaucetRequestButton({ setLocalLoading(false) } + const validateAmount = (amount: number) => + amount >= minTez && amount <= maxTez + const updateAmount = (e: React.ChangeEvent) => { const value = Number(e.target.value.slice(0, 16)) - if (value >= minTez && value <= maxTez) { + if (value === 0 || validateAmount(value)) { setAmount(value) } } @@ -281,7 +284,11 @@ export default function FaucetRequestButton({ -