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