"use client"; import { useState } from "react"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Button } from "@/components/ui/button"; import { ChevronRight, Puzzle, FileText, PanelLeftClose, PanelLeftOpen } from "lucide-react"; import { ComponentPalette } from "./ComponentPalette"; import { TemplatePalette } from "./TemplatePalette"; import { useReportDesigner } from "@/contexts/ReportDesignerContext"; interface AccordionSection { id: string; label: string; icon: React.ReactNode; } const SECTIONS: AccordionSection[] = [ { id: "templates", label: "기본 템플릿", icon: }, { id: "components", label: "컴포넌트", icon: }, ]; export function ReportDesignerLeftPanel() { const [expandedSection, setExpandedSection] = useState("components"); const { isLeftPanelCollapsed, setIsLeftPanelCollapsed } = useReportDesigner(); const toggleSection = (id: string) => { setExpandedSection(expandedSection === id ? "" : id); }; if (isLeftPanelCollapsed) { return ( setIsLeftPanelCollapsed(false)} title="도구상자 열기" > {SECTIONS.map((section) => ( { setIsLeftPanelCollapsed(false); setExpandedSection(section.id); }} > {section.icon} ))} ); } return ( 도구상자 setIsLeftPanelCollapsed(true)} title="도구상자 접기" > {SECTIONS.map((section) => { const isExpanded = expandedSection === section.id; return ( toggleSection(section.id)} className={`flex h-14 w-full items-center justify-between px-5 transition-colors ${ isExpanded ? "bg-linear-to-r from-blue-600 to-indigo-600 text-white shadow-sm" : "bg-white text-gray-900 hover:bg-gray-50" }`} > {section.icon} {section.label} {isExpanded && ( {section.id === "templates" && } {section.id === "components" && } )} ); })} ); }