"use client"; import React from "react"; import { ComponentData } from "@/types/screen"; import { componentRegistry, ComponentRenderer } from "../DynamicComponentRenderer"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Info, AlertTriangle, CheckCircle, XCircle } from "lucide-react"; // 알림 컴포넌트 렌더러 const AlertRenderer: ComponentRenderer = ({ component, ...props }) => { const config = component.componentConfig || {}; const { title = "알림 제목", message = "알림 메시지입니다.", type = "info", // info, warning, success, error showIcon = true, style = {}, } = config; const getAlertIcon = () => { switch (type) { case "warning": return ; case "success": return ; case "error": return ; default: return ; } }; const getAlertVariant = () => { switch (type) { case "error": return "destructive"; default: return "default"; } }; return (
{showIcon && getAlertIcon()} {title} {message}
); }; // 레지스트리에 등록 componentRegistry.register("alert", AlertRenderer); componentRegistry.register("alert-info", AlertRenderer); export { AlertRenderer };