feat(drag-drop-container): replace border highlight with animated glass overlay on drag

This commit is contained in:
2026-04-08 00:56:38 -04:00
parent 8b54a661fe
commit 5c7003fd13

View File

@@ -1,3 +1,7 @@
"use client";
import { AnimatePresence, motion } from "framer-motion";
import { FileUp } from "lucide-react";
import type { ReactNode } from "react"; import type { ReactNode } from "react";
import { toast } from "sonner"; import { toast } from "sonner";
import { IMAGE_EXTENSIONS } from "@/lib/constants"; import { IMAGE_EXTENSIONS } from "@/lib/constants";
@@ -46,7 +50,7 @@ export const DragDropContainer = ({
} else if (fileType === "image" && onImageDrop) { } else if (fileType === "image" && onImageDrop) {
onImageDrop(file); onImageDrop(file);
} else { } else {
toast.warning("Please drop an .ics file or an image"); toast.warning("Drop an .ics file or an event screenshot");
} }
} }
}; };
@@ -57,15 +61,33 @@ export const DragDropContainer = ({
onDragOver={handleDragOver} onDragOver={handleDragOver}
onDragLeave={handleDragLeave} onDragLeave={handleDragLeave}
onDrop={handleDrop} onDrop={handleDrop}
className={`p-4 min-h-[80vh] flex flex-col rounded border-2 border-dashed transition ${ className="relative flex flex-col"
isDragOver ? "border-blue-500 bg-blue-50" : "border-gray-700"
}`}
> >
<AnimatePresence>
{isDragOver && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
className="absolute inset-0 z-40 rounded-xl border-2 border-dashed border-primary/50 bg-primary/5 backdrop-blur-sm flex items-center justify-center"
>
<div className="flex flex-col items-center gap-2 text-primary">
<FileUp className="h-8 w-8" />
<span className="text-sm font-medium">
Drop .ics or image here
</span>
</div>
</motion.div>
)}
</AnimatePresence>
{children} {children}
<div className="mt-auto w-full pb-4 text-gray-400">
<div className="max-w-fit m-auto"> <div className="pt-6 pb-2">
Drag & Drop *.ics or an event screenshot here <p className="text-center text-xs text-muted-foreground/40">
</div> Drag & drop .ics files or event screenshots
</p>
</div> </div>
</section> </section>
); );