import { FileAddOutlined, UploadOutlined } from '@ant-design/icons'; import { Button, Input, Modal, Upload } from 'antd'; import { useEffect, useState } from 'react'; const { Dragger } = Upload; type ReplaceDocModalProps = { open: boolean; docName: string; organizationName: string | null; submitting: boolean; onCancel: () => void; onSubmit: (file: File, reason: string) => void; }; export default function ReplaceDocModal({ open, docName, organizationName, submitting, onCancel, onSubmit }: ReplaceDocModalProps) { const [reason, setReason] = useState(''); const [file, setFile] = useState(null); // при каждом открытии — пустая форма useEffect(() => { if (open) { setReason(''); setFile(null); } }, [open]); return ( file && onSubmit(file, reason.trim())} okText='Загрузить' okButtonProps={{ icon: , disabled: file === null || reason.trim().length === 0, }} confirmLoading={submitting}>
{organizationName && {organizationName}}
Заменяемый документ: {docName}
setReason(e.target.value)} /> { setFile(f); return false; }} onRemove={() => setFile(null)}>

Перетащите файл сюда

); }