Skip to content

Commit 33b82f1

Browse files
fix: decimal issue on donation modal
1 parent b1f21b6 commit 33b82f1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/grant-explorer/src/features/projects/ViewProject.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,13 @@ export default function ViewProject() {
441441
aria-label={"Donation amount for all projects "}
442442
id={"input-donationamount"}
443443
min="0"
444-
type="number"
444+
type="text"
445445
value={directDonationAmount}
446446
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
447-
setDirectDonationAmount(e.target.value);
447+
const value = e.target.value.replace(",", ".");
448+
if (/^\d*\.?\d*$/.test(value) || value === "") {
449+
setDirectDonationAmount(value);
450+
}
448451
}}
449452
className="w-16 lg:w-18"
450453
/>

0 commit comments

Comments
 (0)