2026-03-11 14:54:47 +09:00
|
|
|
"use client";
|
|
|
|
|
|
2025-09-10 14:09:32 +09:00
|
|
|
import React from "react";
|
2026-03-11 14:54:47 +09:00
|
|
|
import { ConfigPanelBuilder } from "@/lib/registry/components/common/ConfigPanelBuilder";
|
|
|
|
|
import { ConfigSectionDefinition } from "@/lib/registry/components/common/ConfigPanelTypes";
|
2025-09-10 14:09:32 +09:00
|
|
|
|
|
|
|
|
interface CardConfigPanelProps {
|
2026-03-11 14:54:47 +09:00
|
|
|
config?: Record<string, any>;
|
|
|
|
|
onChange?: (key: string, value: any) => void;
|
|
|
|
|
component?: any;
|
|
|
|
|
onUpdateProperty?: (path: string, value: any) => void;
|
2025-09-10 14:09:32 +09:00
|
|
|
}
|
|
|
|
|
|
2026-03-11 14:54:47 +09:00
|
|
|
const sections: ConfigSectionDefinition[] = [
|
|
|
|
|
{
|
|
|
|
|
id: "content",
|
|
|
|
|
title: "콘텐츠",
|
|
|
|
|
fields: [
|
|
|
|
|
{
|
|
|
|
|
key: "title",
|
|
|
|
|
label: "카드 제목",
|
|
|
|
|
type: "text",
|
|
|
|
|
placeholder: "카드 제목을 입력하세요",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "content",
|
|
|
|
|
label: "카드 내용",
|
|
|
|
|
type: "textarea",
|
|
|
|
|
placeholder: "카드 내용을 입력하세요",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: "style",
|
|
|
|
|
title: "스타일",
|
|
|
|
|
fields: [
|
|
|
|
|
{
|
|
|
|
|
key: "variant",
|
|
|
|
|
label: "카드 스타일",
|
|
|
|
|
type: "select",
|
|
|
|
|
options: [
|
|
|
|
|
{ label: "기본 (Default)", value: "default" },
|
|
|
|
|
{ label: "테두리 (Outlined)", value: "outlined" },
|
|
|
|
|
{ label: "그림자 (Elevated)", value: "elevated" },
|
|
|
|
|
{ label: "채움 (Filled)", value: "filled" },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "padding",
|
|
|
|
|
label: "패딩",
|
|
|
|
|
type: "select",
|
|
|
|
|
options: [
|
|
|
|
|
{ label: "없음 (None)", value: "none" },
|
|
|
|
|
{ label: "작게 (Small)", value: "small" },
|
|
|
|
|
{ label: "기본 (Default)", value: "default" },
|
|
|
|
|
{ label: "크게 (Large)", value: "large" },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "backgroundColor",
|
|
|
|
|
label: "배경색",
|
|
|
|
|
type: "color",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "borderRadius",
|
|
|
|
|
label: "테두리 반경",
|
|
|
|
|
type: "text",
|
|
|
|
|
placeholder: "8px",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: "display",
|
|
|
|
|
title: "표시 옵션",
|
|
|
|
|
fields: [
|
|
|
|
|
{
|
|
|
|
|
key: "showHeader",
|
|
|
|
|
label: "헤더 표시",
|
|
|
|
|
type: "switch",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const CardConfigPanel: React.FC<CardConfigPanelProps> = ({
|
|
|
|
|
config: directConfig,
|
|
|
|
|
onChange: directOnChange,
|
|
|
|
|
component,
|
|
|
|
|
onUpdateProperty,
|
|
|
|
|
}) => {
|
|
|
|
|
const config = directConfig || component?.componentConfig || {};
|
2025-09-10 14:09:32 +09:00
|
|
|
|
2026-03-11 14:54:47 +09:00
|
|
|
const handleChange = (key: string, value: any) => {
|
|
|
|
|
if (directOnChange) {
|
|
|
|
|
directOnChange(key, value);
|
|
|
|
|
} else if (onUpdateProperty) {
|
|
|
|
|
onUpdateProperty(`componentConfig.${key}`, value);
|
|
|
|
|
}
|
2025-09-10 14:09:32 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2026-03-11 14:54:47 +09:00
|
|
|
<ConfigPanelBuilder
|
|
|
|
|
config={config}
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
sections={sections}
|
|
|
|
|
/>
|
2025-09-10 14:09:32 +09:00
|
|
|
);
|
|
|
|
|
};
|