"use client"; import { useDrag } from "react-dnd"; import { Type, Table, Image, Minus, PenLine, Stamp as StampIcon, Hash, CreditCard, Calculator, Barcode, CheckSquare } from "lucide-react"; interface ComponentItem { type: string; label: string; icon: React.ReactNode; } const COMPONENTS: ComponentItem[] = [ { type: "text", label: "텍스트", icon: }, { type: "table", label: "테이블", icon: }, { type: "image", label: "이미지", icon: }, { type: "divider", label: "구분선", icon: }, { type: "signature", label: "서명란", icon: }, { type: "stamp", label: "도장란", icon: }, { type: "pageNumber", label: "페이지번호", icon: }, { type: "card", label: "정보카드", icon: }, { type: "calculation", label: "계산", icon: }, { type: "barcode", label: "바코드/QR", icon: }, { type: "checkbox", 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) => ( ))}
); }