import { useRef } from 'react'; import useEscapeKey from '../../hooks/useEscapeKey'; import { CrossIcon } from '../Icons'; import Button from './Button'; import MiniButton from './MiniButton'; import Overlay from './Overlay'; export interface ModalProps { title?: string submitText?: string submitInvalidTooltip?: string readonly?: boolean canSubmit?: boolean hideWindow: () => void onSubmit?: () => void onCancel?: () => void children: React.ReactNode } function Modal({ title, hideWindow, onSubmit, readonly, onCancel, canSubmit, submitInvalidTooltip, children, submitText = 'Продолжить' }: ModalProps) { const ref = useRef(null); useEscapeKey(hideWindow); const handleCancel = () => { hideWindow(); if (onCancel) onCancel(); }; const handleSubmit = () => { hideWindow(); if (onSubmit) onSubmit(); }; return ( <>
} onClick={handleCancel} /> {title ?

{title}

: null}
{children}
{!readonly ?
); } export default Modal;