"use client";
import { useDrag } from "react-dnd";
import { Type, Table, Tag } from "lucide-react";
interface ComponentItem {
type: string;
label: string;
icon: React.ReactNode;
}
const COMPONENTS: ComponentItem[] = [
{ type: "text", label: "텍스트", icon: },
{ type: "table", label: "테이블", icon:
},
{ type: "label", label: "레이블", icon: },
];
function DraggableComponentItem({ type, label, icon }: ComponentItem) {
const [{ isDragging }, drag] = useDrag(() => ({
type: "component",
item: { componentType: type },
collect: (monitor) => ({
isDragging: monitor.isDragging(),
}),
}));
return (
{icon}
{label}
);
}
export function ComponentPalette() {
return (
{COMPONENTS.map((component) => (
))}
);
}