diff --git a/frontend/components/screen/config-panels/AlertConfigPanel.tsx b/frontend/components/screen/config-panels/AlertConfigPanel.tsx index f842789e..8bae4f44 100644 --- a/frontend/components/screen/config-panels/AlertConfigPanel.tsx +++ b/frontend/components/screen/config-panels/AlertConfigPanel.tsx @@ -1,70 +1,80 @@ "use client"; import React from "react"; -import { Label } from "@/components/ui/label"; -import { Input } from "@/components/ui/input"; -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; -import { Switch } from "@/components/ui/switch"; -import { Textarea } from "@/components/ui/textarea"; -import { ComponentData } from "@/types/screen"; +import { ConfigPanelBuilder } from "@/lib/registry/components/common/ConfigPanelBuilder"; +import { ConfigSectionDefinition } from "@/lib/registry/components/common/ConfigPanelTypes"; interface AlertConfigPanelProps { - component: ComponentData; - onUpdateProperty: (path: string, value: any) => void; + config?: Record; + onChange?: (key: string, value: any) => void; + component?: any; + onUpdateProperty?: (path: string, value: any) => void; } -export const AlertConfigPanel: React.FC = ({ component, onUpdateProperty }) => { - const config = component.componentConfig || {}; +const sections: ConfigSectionDefinition[] = [ + { + id: "content", + title: "콘텐츠", + fields: [ + { + key: "title", + label: "제목", + type: "text", + placeholder: "알림 제목을 입력하세요", + }, + { + key: "message", + label: "메시지", + type: "textarea", + placeholder: "알림 메시지를 입력하세요", + }, + ], + }, + { + id: "style", + title: "스타일", + fields: [ + { + key: "type", + label: "알림 타입", + type: "select", + options: [ + { label: "정보 (Info)", value: "info" }, + { label: "경고 (Warning)", value: "warning" }, + { label: "성공 (Success)", value: "success" }, + { label: "오류 (Error)", value: "error" }, + ], + }, + { + key: "showIcon", + label: "아이콘 표시", + type: "switch", + }, + ], + }, +]; + +export const AlertConfigPanel: React.FC = ({ + config: directConfig, + onChange: directOnChange, + component, + onUpdateProperty, +}) => { + const config = directConfig || component?.componentConfig || {}; + + const handleChange = (key: string, value: any) => { + if (directOnChange) { + directOnChange(key, value); + } else if (onUpdateProperty) { + onUpdateProperty(`componentConfig.${key}`, value); + } + }; return ( -
-
- - onUpdateProperty("componentConfig.title", e.target.value)} - placeholder="알림 제목을 입력하세요" - /> -
- -
- -