"use client"; import React from "react"; import { ComponentData } from "@/types/screen"; import { componentRegistry, ComponentRenderer } from "../DynamicComponentRenderer"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { TrendingUp, TrendingDown, Minus } from "lucide-react"; // 통계 카드 컴포넌트 렌더러 const StatsCardRenderer: ComponentRenderer = ({ component, ...props }) => { const config = component.componentConfig || {}; const { title = "통계 제목", value = "1,234", change = "+12.5%", trend = "up", // up, down, neutral description = "전월 대비", style = {}, } = config; const getTrendIcon = () => { switch (trend) { case "up": return ; case "down": return ; default: return ; } }; const getTrendColor = () => { switch (trend) { case "up": return "text-green-600"; case "down": return "text-red-600"; default: return "text-gray-600"; } }; return ( {title}
{value}
{getTrendIcon()} {change} {description}
); }; // 레지스트리에 등록 componentRegistry.register("stats", StatsCardRenderer); componentRegistry.register("stats-card", StatsCardRenderer); export { StatsCardRenderer };