"use client"; /** * 노드 팔레트 사이드바 */ import { useState } from "react"; import { ChevronDown, ChevronRight } from "lucide-react"; import { NODE_CATEGORIES, getNodesByCategory } from "./nodePaletteConfig"; import type { NodePaletteItem } from "@/types/node-editor"; export function NodePalette() { const [expandedCategories, setExpandedCategories] = useState>( new Set(), // 기본적으로 모든 아코디언 닫힘 ); const toggleCategory = (categoryId: string) => { setExpandedCategories((prev) => { const next = new Set(prev); if (next.has(categoryId)) { next.delete(categoryId); } else { next.add(categoryId); } return next; }); }; return (
{/* 헤더 */}

노드 라이브러리

캔버스로 드래그하여 추가

{/* 노드 목록 */}
{NODE_CATEGORIES.map((category) => { const isExpanded = expandedCategories.has(category.id); const nodes = getNodesByCategory(category.id); return (
{/* 카테고리 헤더 */} {/* 노드 아이템들 */} {isExpanded && (
{nodes.map((node) => ( ))}
)}
); })}
{/* 푸터 도움말 */}

💡 노드를 드래그하여 캔버스에 배치하고 연결선으로 연결하세요

); } /** * 노드 팔레트 아이템 컴포넌트 */ function NodePaletteItemComponent({ node }: { node: NodePaletteItem }) { const onDragStart = (event: React.DragEvent) => { event.dataTransfer.setData("application/reactflow", node.type); event.dataTransfer.effectAllowed = "move"; }; return (
{/* 색상 인디케이터 (좌측) */}
{/* 라벨 및 설명 */}
{node.label}
{node.description}
{/* 하단 색상 인디케이터 (hover 시) */}
); }