"use client"; import React from "react"; import { ComponentRegistry } from "../../ComponentRegistry"; import { ComponentCategory } from "@/types/component"; import { Folder } from "lucide-react"; import type { TabsComponent, TabItem } from "@/types/screen-management"; /** * 탭 컴포넌트 정의 * * 여러 화면을 탭으로 구분하여 전환할 수 있는 컴포넌트 */ ComponentRegistry.registerComponent({ id: "tabs-widget", name: "탭 컴포넌트", description: "화면을 탭으로 전환할 수 있는 컴포넌트입니다. 각 탭마다 다른 화면을 연결할 수 있습니다.", category: ComponentCategory.LAYOUT, webType: "text" as any, // 레이아웃 컴포넌트이므로 임시값 component: () => null as any, // 레이아웃 컴포넌트이므로 임시값 defaultConfig: {}, tags: ["tabs", "navigation", "layout", "screen"], icon: Folder, version: "1.0.0", defaultSize: { width: 800, height: 600, }, defaultProps: { type: "tabs" as const, tabs: [ { id: "tab-1", label: "탭 1", order: 0, disabled: false, }, { id: "tab-2", label: "탭 2", order: 1, disabled: false, }, ] as TabItem[], defaultTab: "tab-1", orientation: "horizontal" as const, variant: "default" as const, allowCloseable: false, persistSelection: false, }, // 에디터 모드에서의 렌더링 renderEditor: ({ component, isSelected, onClick, onDragStart, onDragEnd, children }) => { const tabsComponent = component as TabsComponent; const tabs = tabsComponent.tabs || []; return (
탭 컴포넌트
{tabs.length > 0 ? `${tabs.length}개의 탭 (실제 화면에서 표시됩니다)` : "탭이 없습니다. 설정 패널에서 탭을 추가하세요"}
{tabs.length > 0 && (