From 0e8a6abe824a4589cb3278f6fe7e00df527995b0 Mon Sep 17 00:00:00 2001 From: zaidmukaddam Date: Thu, 5 Sep 2024 11:26:28 +0530 Subject: [PATCH] feat: add file drag and drop --- app/search/page.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/search/page.tsx b/app/search/page.tsx index cbb2c1a..a1ead0a 100644 --- a/app/search/page.tsx +++ b/app/search/page.tsx @@ -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); + }} 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'}