"use client"; import { Eye } from "lucide-react"; import type { ComponentConfig } from "@/types/report"; interface TablePreviewPanelProps { component: ComponentConfig; } export function TablePreviewPanel({ component }: TablePreviewPanelProps) { const visibleCols = (component.tableColumns ?? []).filter((c) => c.visible !== false); const hasColumns = visibleCols.length > 0; const previewRowCount = component.tableRowCount ?? 3; const headerBg = component.headerBackgroundColor || "#f3f4f6"; const headerColor = component.headerTextColor || "#111827"; const rowHeight = component.rowHeight ?? 28; const hasBorder = component.showBorder !== false; const borderClass = hasBorder ? "border border-gray-300" : ""; const totalConfigWidth = visibleCols.reduce((s, c) => s + (c.width || 120), 0); return (
미리보기 (저장 전 상태)

실제 데이터는 저장 후 확인 가능합니다.

{hasColumns ? (
{visibleCols.map((col, idx) => { const ratio = (col.width || 120) / totalConfigWidth; return ; })} {visibleCols.map((col, idx) => ( ))} {Array.from({ length: previewRowCount }).map((_, rowIdx) => ( {visibleCols.map((col, colIdx) => ( ))} ))}
{col.header}
{col.field ? `{${col.field}}` : "—"}
) : (
컬럼을 설정하면 미리보기가 표시됩니다.
)}
); }