Modal cleanup, begin transitioning towards the new dialog
This commit is contained in:
parent
3834aca3fe
commit
7dd74ecc9d
10 changed files with 121 additions and 96 deletions
|
@ -0,0 +1,22 @@
|
|||
import React from 'react';
|
||||
import { Dialog } from '@/components/elements/dialog/index';
|
||||
import { DialogProps } from '@/components/elements/dialog/Dialog';
|
||||
import { Button } from '@/components/elements/button/index';
|
||||
|
||||
type ConfirmationProps = Omit<DialogProps, 'description' | 'children'> & {
|
||||
children: React.ReactNode;
|
||||
confirm?: string | undefined;
|
||||
onConfirmed: () => void;
|
||||
}
|
||||
|
||||
export default ({ confirm = 'Okay', children, onConfirmed, ...props }: ConfirmationProps) => {
|
||||
return (
|
||||
<Dialog {...props} description={typeof children === 'string' ? children : undefined}>
|
||||
{typeof children !== 'string' && children}
|
||||
<Dialog.Buttons>
|
||||
<Button.Text onClick={props.onClose}>Cancel</Button.Text>
|
||||
<Button.Danger onClick={onConfirmed}>{confirm}</Button.Danger>
|
||||
</Dialog.Buttons>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
Reference in a new issue