import React from 'react'; import constants from 'utils/strings/constants'; import { Breakpoint, Button, Dialog, DialogActions, DialogContent, DialogProps, } from '@mui/material'; import DialogTitleWithCloseButton from './titleWithCloseButton'; import MessageText from './messageText'; import DialogBoxBase from './base'; import { DialogBoxAttributes } from 'types/dialogBox'; type IProps = React.PropsWithChildren< Omit & { onClose: () => void; attributes: DialogBoxAttributes; size?: Breakpoint; titleCloseButton?: boolean; } >; export default function DialogBox({ attributes, children, ...props }: IProps) { if (!attributes) { return ; } const handleClose: DialogProps['onClose'] = (_, reason) => { if (attributes?.nonClosable) { // no-op } else if (attributes?.staticBackdrop && reason === 'backdropClick') { // no-op } else { props.onClose(); } }; return ( {attributes.title && ( {attributes.title} )} {(children || attributes?.content) && ( {children || ( {attributes.content} )} )} {(attributes.close || attributes.proceed) && ( <> {attributes.close && ( )} {attributes.proceed && ( )} )} ); }