import classNames from 'classnames'; import * as React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import Button from '../button/button'; import IconButton from '../icon-button/icon-button'; const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, }); interface IModal { cancelAction?: () => void, cancelText?: string, confirmationAction?: () => void, confirmationDisabled?: boolean, confirmationText?: string, confirmationTheme?: 'danger', onClose: () => void, secondaryAction?: () => void, secondaryText?: string, title: string | React.ReactNode, } const Modal: React.FC = ({ cancelAction, cancelText, children, confirmationAction, confirmationDisabled, confirmationText, confirmationTheme, onClose, secondaryAction, secondaryText, title, }) => { const intl = useIntl(); const buttonRef = React.useRef(null); React.useEffect(() => { if (buttonRef?.current) { buttonRef.current.focus(); } }, [buttonRef]); return (

{title}

{onClose && ( )}
{children}
{confirmationAction && (
{cancelAction && ( )}
{secondaryAction && ( )}
)}
); }; export default Modal;