import { useRef, useState } from 'react' import type { DragEvent } from 'react' interface Props { file: File | null disabled: boolean onSelect: (file: File) => void } /** * Зона drag&drop + клик для выбора .docx/.doc. Скрытый input[type=file] — * единственный источник выбора; drop берёт первый файл. */ export default function DropZone({ file, disabled, onSelect }: Props) { const inputRef = useRef(null) const [dragging, setDragging] = useState(false) const onDrop = (e: DragEvent) => { e.preventDefault() setDragging(false) if (disabled) return const dropped = e.dataTransfer.files[0] if (dropped) onSelect(dropped) } return ( ) }