feat(drag-drop-container): replace border highlight with animated glass overlay on drag
This commit is contained in:
@@ -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"
|
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{children}
|
<AnimatePresence>
|
||||||
<div className="mt-auto w-full pb-4 text-gray-400">
|
{isDragOver && (
|
||||||
<div className="max-w-fit m-auto">
|
<motion.div
|
||||||
Drag & Drop *.ics or an event screenshot here
|
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>
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
|
||||||
|
{children}
|
||||||
|
|
||||||
|
<div className="pt-6 pb-2">
|
||||||
|
<p className="text-center text-xs text-muted-foreground/40">
|
||||||
|
Drag & drop .ics files or event screenshots
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user