Skip to content

Commit

Permalink
🚀 Fit to starndars the ParameterDialog form
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniovizuete committed Oct 5, 2022
1 parent 5a102a5 commit 05bad0a
Showing 1 changed file with 38 additions and 29 deletions.
67 changes: 38 additions & 29 deletions src/components/QueryForm/components/ParameterDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export default function ParameterDialog({
clearState();
};

const handleOnClickSave = () => {
const handleOnClickSave = (e: React.SyntheticEvent<HTMLFormElement>) => {
e.preventDefault();
e.stopPropagation();
if (key && value) {
onConfirm(key, value, data ? "edit" : "new");
clearState();
Expand All @@ -53,35 +55,42 @@ export default function ParameterDialog({
isOpen={isOpen}
onClose={handleOnClickClose}
>
<div className={Classes.DIALOG_BODY}>
<ControlGroup vertical>
<InputGroup
placeholder="Key"
value={key}
onChange={(e) => setKey(e.target.value)}
disabled={data !== undefined}
/>
<InputGroup
placeholder="Value"
value={value}
onChange={(e) => setValue(e.target.value)}
/>
</ControlGroup>
</div>
<div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
<Button onClick={handleOnClickClose} intent={Intent.NONE}>
Close
</Button>
<Button
disabled={!key || !value}
onClick={handleOnClickSave}
intent={Intent.PRIMARY}
>
Save
</Button>
<form onSubmit={handleOnClickSave}>
<div className={Classes.DIALOG_BODY}>
<ControlGroup vertical>
<InputGroup
placeholder="Key"
value={key}
onChange={(e) => setKey(e.target.value)}
disabled={data !== undefined}
/>
<InputGroup
placeholder="Value"
value={value}
onChange={(e) => setValue(e.target.value)}
/>
</ControlGroup>
</div>
</div>
<div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
<Button
onClick={handleOnClickClose}
intent={Intent.NONE}
type="reset"
>
Close
</Button>
<Button
type="submit"
disabled={!key || !value}
//onClick={handleOnClickSave}
intent={Intent.PRIMARY}
>
Save
</Button>
</div>
</div>
</form>
</Dialog>
);
}

0 comments on commit 05bad0a

Please sign in to comment.