import { MouseEventHandler } from 'react'; import { Box, ButtonProps, Dialog, DialogProps } from '@mui/material'; import ContainedButton from './ContainedButton'; import { Panel, PanelHeader } from './Panels'; import { BodyText, HeaderText } from './Text'; type ConfirmDialogProps = { actionCancelText?: string; actionProceedText: string; contentText: string; dialogProps: DialogProps; onCancel: MouseEventHandler; onProceed: MouseEventHandler; proceedButtonProps?: ButtonProps; titleText: string; }; const CONFIRM_DIALOG_DEFAULT_PROPS = { actionCancelText: 'Cancel', proceedButtonProps: { sx: undefined }, }; const ConfirmDialog = ( { actionCancelText, actionProceedText, contentText, dialogProps: { open }, onCancel, onProceed, proceedButtonProps, titleText, }: ConfirmDialogProps = CONFIRM_DIALOG_DEFAULT_PROPS as ConfirmDialogProps, ): JSX.Element => { const { sx: proceedButtonSx } = proceedButtonProps ?? CONFIRM_DIALOG_DEFAULT_PROPS.proceedButtonProps; return ( :not(:first-child)': { marginLeft: '.5em', }, }} > {actionCancelText} {actionProceedText} ); }; ConfirmDialog.defaultProps = CONFIRM_DIALOG_DEFAULT_PROPS; export default ConfirmDialog;