Skip to content

Commit 9943bef

Browse files
feature: drag and drop with dropzone
1 parent 295aeba commit 9943bef

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

src/app/page.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { Github, Upload } from "lucide-react";
44
import Link from "next/link";
5+
import Dropzone from "react-dropzone";
56

67
export default function Home() {
78
return (
@@ -14,13 +15,22 @@ export default function Home() {
1415
</h2>
1516

1617
{/* Drop Zone */}
17-
<div className="border-2 px-1/2 py-30 flex flex-col gap-8 items-center justify-center w-1/2 border-dashed rounded-3xl mt-12 text-lg hover:cursor-pointer">
18-
<Upload size={50}></Upload>
19-
Drag & drop your followers.json & following.json files here
20-
<span>or</span>
21-
<button className="border-1 px-4 py-2 text-lg rounded-xl hover:cursor-pointer transition hover:scale-105">Select Files</button>
22-
</div>
23-
18+
<Dropzone onDrop={(acceptedFiles) => console.log(acceptedFiles)}>
19+
{({ getRootProps, getInputProps }) => (
20+
<div
21+
{...getRootProps()}
22+
className="border-2 px-1/2 py-30 flex flex-col gap-8 items-center justify-center w-1/2 border-dashed rounded-3xl mt-12 text-lg hover:cursor-pointer"
23+
>
24+
<input {...getInputProps()}></input>
25+
<Upload size={50}></Upload>
26+
Drag & drop your followers.json & following.json files here
27+
<span>or</span>
28+
<button className="border-1 px-4 py-2 text-lg rounded-xl hover:cursor-pointer transition hover:scale-105">
29+
Select Files
30+
</button>
31+
</div>
32+
)}
33+
</Dropzone>
2434
<Link href="/tutorial" className="underline">
2535
{" "}
2636
Don&apos;t have your files? Here&apos;s how to get them.

0 commit comments

Comments
 (0)