Skip to content

Commit 39ae900

Browse files
Merge pull request #162 from devtron-labs/feat/generic-gitops
feat: add handleDisableSubmitOnEnter for forms
2 parents ee514cf + 6ac925b commit 39ae900

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.0.86",
3+
"version": "0.0.86-beta-3",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Helpers.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ export const getWebhookEventIcon = (eventName: WebhookEventNameType) => {
120120

121121
export const isNullOrUndefined = (value: unknown): boolean => value === null || value === undefined
122122

123+
export const handleDisableSubmitOnEnter = (event: React.KeyboardEvent<HTMLFormElement>) => {
124+
if (event.key === 'Enter') {
125+
event.preventDefault()
126+
}
127+
}
128+
123129
export const getKeyToBooleanMapFromArray = <T extends string | number>(arr: T[] = []) =>
124130
arr.reduce<Record<T, boolean>>(
125131
(acc, key) => {

0 commit comments

Comments
 (0)