Files
linkwarden/apps/web/components/Droppable.tsx
daniel31x13 d0cf951731 minor fix
2025-08-10 18:12:57 -04:00

51 lines
917 B
TypeScript

import { cn } from "@/lib/utils";
import { useDroppable } from "@dnd-kit/core";
const Droppable = ({
children,
id,
data,
className,
}: {
children: React.ReactNode;
id: string;
data?: {
/**
* Id of collection or tag to drop into.
*/
id?: string;
/**
* Name of collection or tag to drop into.
*/
name?: string;
ownerId?: string;
type?: "collection" | "tag";
};
className?: string;
}) => {
const { setNodeRef, isOver } = useDroppable({
id,
data,
});
return (
<div
ref={setNodeRef}
className={cn(
isOver &&
"bg-primary/10 outline-2 outline-dashed outline-primary rounded-lg",
className
)}
data-over={isOver ? "true" : undefined}
style={{
position: "relative",
zIndex: isOver ? 1 : "auto",
}}
>
{children}
</div>
);
};
export default Droppable;