feat: add file drag and drop

This commit is contained in:
zaidmukaddam 2024-09-05 11:26:28 +05:30
parent 212415d5ef
commit 0e8a6abe82

View File

@ -1703,6 +1703,11 @@ export default function Home() {
onSubmit(e);
}
}}
onDrag={e => e.preventDefault()}
onDrop={e => {
e.preventDefault();
handleFileChange({ target: { files: e.dataTransfer?.files } } as React.ChangeEvent<HTMLInputElement>);
}}
className={`
${hasSubmitted ? 'fixed bottom-4 left-1/2 -translate-x-1/2 max-w-[90%] sm:max-w-2xl' : 'max-w-full'}
${attachments.length > 0 || uploadingAttachments.length > 0 ? 'rounded-2xl' : 'rounded-full'}