From d43fefd8a4556b1fa55417d1169c7a8eea841df1 Mon Sep 17 00:00:00 2001 From: MuhammadUmer44 Date: Thu, 26 Sep 2024 15:35:38 +0500 Subject: [PATCH] fix(create-bounty): prevent empty spaces --- .../CreateBountyModal/CreateBounty/index.tsx | 7 +++++++ .../ModalsContainer/CreateBountyModal/constants.ts | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/ModalsContainer/CreateBountyModal/CreateBounty/index.tsx b/src/components/ModalsContainer/CreateBountyModal/CreateBounty/index.tsx index 787a6a036..6d2fab435 100644 --- a/src/components/ModalsContainer/CreateBountyModal/CreateBounty/index.tsx +++ b/src/components/ModalsContainer/CreateBountyModal/CreateBounty/index.tsx @@ -30,6 +30,12 @@ export const CreateBounty: FC = ({ errMessage, handleClose }) => { const isDisable = isBudgetValid(watchBudget) && !!watchNodeType + const handleKeyDown = (event: React.KeyboardEvent) => { + if (event.key === ' ') { + event.preventDefault() + } + } + return ( @@ -46,6 +52,7 @@ export const CreateBounty: FC = ({ errMessage, handleClose }) => { { const trimmedBudget = budget.trim() - return !!(trimmedBudget && /^[0-9]+$/.test(trimmedBudget)) + return !!(trimmedBudget && BUDGET_PATTERN.test(trimmedBudget)) } - -export const BUDGET_PATTERN = /^[0-9]+$/