give SimpleModal component a secondary action

This commit is contained in:
fmtabbara
2022-06-10 21:49:26 +01:00
parent b731aa0bcf
commit 7d4f6c0bbd
@@ -6,13 +6,14 @@ import { modalStyle } from './styles';
export const SimpleModal: React.FC<{
open: boolean;
onClose?: () => void;
onOk?: () => void;
onOk?: () => Promise<void>;
header: string;
subHeader?: string;
okLabel: string;
okDisabled?: boolean;
sx?: SxProps;
}> = ({ open, onClose, okDisabled, onOk, header, subHeader, okLabel, sx, children }) => (
SecondaryAction?: React.ReactNode;
}> = ({ open, onClose, okDisabled, onOk, header, subHeader, okLabel, sx, SecondaryAction, children }) => (
<Modal open={open} onClose={onClose}>
<Box sx={{ ...modalStyle, ...sx }}>
<Stack direction="row" justifyContent="space-between" alignItems="center">
@@ -29,9 +30,11 @@ export const SimpleModal: React.FC<{
{children}
<Button variant="contained" fullWidth sx={{ mt: 3 }} size="large" onClick={onOk} disabled={okDisabled}>
<Button variant="contained" fullWidth size="large" onClick={onOk} disabled={okDisabled} sx={{ mt: 2 }}>
{okLabel}
</Button>
{SecondaryAction}
</Box>
</Modal>
);