Files
invyone/frontend/components/v2/config-panels/InvLegacyDividerConfigPanel.tsx
T
DDD1542 a8ded6455d refactor: ConfigPanel Inv 네이밍 통합 + legacy 패널 분리 + input cp 마이그
11 패널 일괄 Inv* prefix 통일:
- 통합 (lib/registry/components/X/): button / container / divider / search /
  stats / table / title / input → Inv*ConfigPanel
- frontend/components/v2/config-panels/V2FieldConfigPanel → InvFieldConfigPanel
- 옛 v2-* hidden 호환 → InvLegacy{Divider,Text,Button}ConfigPanel

input 통합 컴포넌트 cp 톤 신규 작성 (InvInputConfigPanel):
- 277줄 옛 디자인 → CPVisualGrid 10칸 type 카드 + 타입별 옵션 + FeatureChipGrid

getComponentConfigPanel.tsx 버그 수정 (Codex 검토):
- "stats" key 중복 제거 (옛 StatsCardConfigPanel 이 통합 stats 덮던 silent bug)
- ALIAS 에서 v2-button-primary/v2-divider-line/v2-text-display 제외
  (옵션 B 일관성 — 옛 hidden 컴포넌트는 InvLegacy 패널 사용)
- MAP 의 해당 키를 InvLegacy* 로 직접 매핑

호출처 일괄 갱신:
- 각 통합 컴포넌트의 index.ts 7개 (import / config_panel / re-export)
- v2-input/v2-select/v2-divider-line/v2-text-display/v2-button-primary
  의 index.ts (config_panel 매핑)
- V2PropertiesPanel.tsx 의 require pattern (v2-input/v2-select)

검증: tsc 우리 영역 0건 / V2FieldConfigPanel 잔재 0건 / 기존 path 잔재 0건

다음 세션: useDbTables hook 추출 + 잔여 V2* cp 마이그 + dead code 정리

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 17:57:57 +09:00

184 lines
5.5 KiB
TypeScript

"use client";
/**
* InvLegacyDividerConfigPanel — 구분선 (v2-divider-line) cp 톤 설정 패널
*
* 흐름:
* ① 선 모양 — 두께 + 색상 (CPVisualGrid 시각 카드)
* ② 텍스트 표시 — 토글 + 활성 시 텍스트/색
* ▾ 고급 설정 — rounded / disabled (FeatureChipGrid)
*
* Reference: notes/gbpark/2026-04-28-cp-panel-standard.md
*/
import React from "react";
import {
CPSection,
CPRow,
CPGroup,
CPText,
CPColor,
CPSwitch,
CPVisualGrid,
FeatureChipGrid,
Hint,
} from "./_shared/cp";
interface InvLegacyDividerConfigPanelProps {
config: Record<string, any>;
onChange: (config: Record<string, any>) => void;
}
const DEFAULT_LINE_COLOR = "#d1d5db";
const DEFAULT_TEXT_COLOR = "#6b7280";
export const InvLegacyDividerConfigPanel: React.FC<InvLegacyDividerConfigPanelProps> = ({
config,
onChange,
}) => {
const update = (field: string, value: any) => {
const next = { ...config, [field]: value };
onChange(next);
if (typeof window !== "undefined") {
window.dispatchEvent(
new CustomEvent("componentConfigChanged", { detail: { config: next } }),
);
}
};
const lineColor = config.color || DEFAULT_LINE_COLOR;
const thickness = config.thickness || "1px";
return (
<div style={{ fontFamily: "var(--v5-font-sans)", color: "var(--cp-text)", padding: "0 12px" }}>
{/* ── ① 선 모양 ─────────────────────────── */}
<CPSection title="① 선 모양" desc="두께와 색을 골라요">
<CPRow label="두께" />
<CPVisualGrid
cols={3}
value={thickness}
onChange={(v) => update("thickness", v)}
options={[
{
value: "1px",
label: "얇게",
preview: <div style={{ width: "60%", height: 1, background: lineColor }} />,
},
{
value: "2px",
label: "보통",
preview: <div style={{ width: "60%", height: 2, background: lineColor }} />,
},
{
value: "4px",
label: "두껍게",
preview: <div style={{ width: "60%", height: 4, background: lineColor }} />,
},
]}
/>
<div style={{ marginTop: 10 }}>
<CPRow label="프리셋 색" />
<CPVisualGrid
cols={3}
value={lineColor}
onChange={(v) => update("color", v)}
options={[
{
value: "#d1d5db",
label: "기본",
preview: <ColorDot color="#d1d5db" />,
},
{
value: "#9ca3af",
label: "진하게",
preview: <ColorDot color="#9ca3af" />,
},
{
value: "#3b82f6",
label: "강조",
preview: <ColorDot color="#3b82f6" />,
},
]}
/>
</div>
<div style={{ marginTop: 8 }}>
<CPRow label="커스텀 색">
<CPColor value={lineColor} onChange={(v) => update("color", v)} />
</CPRow>
</div>
</CPSection>
{/* ── ② 텍스트 표시 ─────────────────────────── */}
<CPSection title="② 텍스트 표시" desc="선 가운데에 텍스트 (선택)">
<CPRow label="표시 여부">
<CPSwitch
value={!!config.dividerText}
onChange={(checked) => update("dividerText", checked ? "구분" : "")}
/>
</CPRow>
{config.dividerText && (
<>
<CPRow label="텍스트">
<CPText
value={config.dividerText || ""}
onChange={(v) => update("dividerText", v)}
placeholder="구분 텍스트"
/>
</CPRow>
<CPRow label="텍스트 색">
<CPColor
value={config.textColor || DEFAULT_TEXT_COLOR}
onChange={(v) => update("textColor", v)}
/>
</CPRow>
<Hint> .</Hint>
</>
)}
</CPSection>
{/* ── ▾ 고급 설정 ─────────────────────────── */}
<CPGroup title="고급 설정" defaultOpen={false}>
<FeatureChipGrid
items={[
{
key: "rounded",
label: "둥근 끝",
desc: "선의 양쪽 끝을 둥글게(border-radius) 처리합니다.\n두꺼운 선(2px+) 일 때 자연스러워요.",
},
{
key: "disabled",
label: "비활성화",
desc: "구분선을 회색으로 흐리게 표시하고 클릭/이벤트를 차단합니다.\n조건부 표시와 함께 자주 쓰여요.",
},
]}
source={config}
onToggle={(k, v) => update(k, v)}
/>
</CPGroup>
</div>
);
};
InvLegacyDividerConfigPanel.displayName = "InvLegacyDividerConfigPanel";
// 작은 헬퍼 — 색 점 (visual preview)
function ColorDot({ color }: { color: string }) {
return (
<span
style={{
display: "inline-block",
width: 14,
height: 14,
borderRadius: 999,
background: color,
boxShadow: "inset 0 0 0 1px rgba(0,0,0,0.08)",
}}
/>
);
}
export default InvLegacyDividerConfigPanel;