"use client"; import React from "react"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Database, Layout, Cog, Settings, Palette, Monitor, Square } from "lucide-react"; import { cn } from "@/lib/utils"; export interface ToolbarButton { id: string; label: string; icon: React.ReactNode; shortcut: string; group: "source" | "editor"; panelWidth: number; } interface LeftUnifiedToolbarProps { buttons: ToolbarButton[]; panelStates: Record; onTogglePanel: (panelId: string) => void; } export const LeftUnifiedToolbar: React.FC = ({ buttons, panelStates, onTogglePanel }) => { // 그룹별로 버튼 분류 const sourceButtons = buttons.filter((btn) => btn.group === "source"); const editorButtons = buttons.filter((btn) => btn.group === "editor"); const renderButton = (button: ToolbarButton) => { const isActive = panelStates[button.id]?.isOpen || false; return ( ); }; return (
{/* 입력/소스 그룹 */}
{sourceButtons.map(renderButton)}
{/* 편집/설정 그룹 */}
{editorButtons.map(renderButton)}
{/* 하단 여백 */}
); }; // 기본 버튼 설정 export const defaultToolbarButtons: ToolbarButton[] = [ // 입력/소스 그룹 { id: "tables", label: "테이블", icon: , shortcut: "T", group: "source", panelWidth: 380, }, { id: "components", label: "컴포넌트", icon: , shortcut: "C", group: "source", panelWidth: 350, }, // 편집/설정 그룹 { id: "properties", label: "속성", icon: , shortcut: "P", group: "editor", panelWidth: 400, }, { id: "styles", label: "스타일", icon: , shortcut: "S", group: "editor", panelWidth: 360, }, { id: "resolution", label: "해상도", icon: , shortcut: "E", group: "editor", panelWidth: 300, }, { id: "zone", label: "구역", icon: , shortcut: "Z", group: "editor", panelWidth: 0, // 토글만 (패널 없음) }, ]; export default LeftUnifiedToolbar;