diff --git a/catalog/app/components/Dialog/Confirm.tsx b/catalog/app/components/Dialog/Confirm.tsx index 15d1749d709..0146c0e071c 100644 --- a/catalog/app/components/Dialog/Confirm.tsx +++ b/catalog/app/components/Dialog/Confirm.tsx @@ -44,6 +44,7 @@ interface PromptProps { title: string } +// TODO: Re-use utils/Dialog export function useConfirm({ cancelTitle, title, onSubmit, submitTitle }: PromptProps) { const [key, setKey] = React.useState(0) const [opened, setOpened] = React.useState(false) diff --git a/catalog/app/components/Dialog/Prompt.tsx b/catalog/app/components/Dialog/Prompt.tsx index 999d331fa6d..dd87c916468 100644 --- a/catalog/app/components/Dialog/Prompt.tsx +++ b/catalog/app/components/Dialog/Prompt.tsx @@ -4,19 +4,23 @@ import * as M from '@material-ui/core' import * as Lab from '@material-ui/lab' interface DialogProps { + children: React.ReactNode initialValue?: string onCancel: () => void onSubmit: (value: string) => void open: boolean + placeholder?: string title: string validate: (value: string) => Error | undefined } function Dialog({ + children, initialValue, - open, onCancel, onSubmit, + open, + placeholder, title, validate, }: DialogProps) { @@ -26,6 +30,7 @@ function Dialog({ const handleChange = React.useCallback((event) => setValue(event.target.value), []) const handleSubmit = React.useCallback( (event) => { + event.stopPropagation() event.preventDefault() setSubmitted(true) if (!error) onSubmit(value) @@ -37,11 +42,13 @@ function Dialog({