Skip to content

Commit

Permalink
feat: drag and drop files (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortennordseth authored Sep 27, 2024
1 parent 2df07a7 commit 2978bac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/page-modules/contact/components/input/file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export function FileInput({ onChange, label, name }: FileInputProps) {
}
};

const handleDragOver = (event: DragEvent<HTMLDivElement>) => {
event.preventDefault();
};

const handleDrop = (event: DragEvent<HTMLDivElement>) => {
event.preventDefault();

Expand All @@ -44,7 +48,7 @@ export function FileInput({ onChange, label, name }: FileInputProps) {
};

return (
<div onDrop={handleDrop}>
<div onDragOver={handleDragOver} onDrop={handleDrop}>
<input
id={id}
type="file"
Expand Down

0 comments on commit 2978bac

Please sign in to comment.