[questions][fix] fix CreateListDialog layout

pull/547/head
Jeff Sieu 2 years ago
parent b7f5bc004c
commit 3e21aabef3

@ -31,37 +31,15 @@ export default function CreateListDialog({
reset(); reset();
}; };
const handleFormSubmit = handleSubmit(async (data) => {
await onSubmit(data);
reset();
});
return ( return (
<Dialog <Dialog
isShown={show} isShown={show}
primaryButton={undefined} primaryButton={
title="Create question list"
onClose={handleDialogCancel}>
<form
className="mt-5 gap-2 sm:flex sm:items-center"
onSubmit={handleSubmit(async (data) => {
await onSubmit(data);
reset();
})}>
<div className="w-full sm:max-w-xs">
<TextInput
id="listName"
isLabelHidden={true}
{...register('name')}
autoComplete="off"
label="Name"
placeholder="List name"
required={true}
type="text"
/>
</div>
<Button
display="inline"
label="Cancel"
size="md"
variant="tertiary"
onClick={handleDialogCancel}
/>
<Button <Button
disabled={!isDirty} disabled={!isDirty}
display="inline" display="inline"
@ -70,6 +48,30 @@ export default function CreateListDialog({
size="md" size="md"
type="submit" type="submit"
variant="primary" variant="primary"
onClick={handleFormSubmit}
/>
}
secondaryButton={
<Button
display="inline"
label="Cancel"
size="md"
variant="tertiary"
onClick={handleDialogCancel}
/>
}
title="Create question list"
onClose={handleDialogCancel}>
<form className="w-full" onSubmit={handleFormSubmit}>
<TextInput
id="listName"
isLabelHidden={true}
{...register('name')}
autoComplete="off"
label="Name"
placeholder="List name"
required={true}
type="text"
/> />
</form> </form>
</Dialog> </Dialog>

Loading…
Cancel
Save