260127_01_ENH: 커스텀 컴포넌트들 1차 완성 및 일부페이지에 SampleData 적용

This commit is contained in:
2026-01-27 16:59:24 +09:00
parent 76c2626507
commit 8bfa8fa7c4
33 changed files with 3035 additions and 35 deletions

View File

@@ -1,6 +1,58 @@
'use client'
import {Button} from "@/components/ui/button";
import TopChartTable from "../../../../../components/lge-dashboard/combo/TopChartTable";
import {PRODUCT_KEYS, PRODUCTS} from "@/const/lgConst";
import {
AXIS_HIDE_STYLE, ChartData,
GRID_X_NOT_PADDING,
signStyleGapRow,
TopChartTableRow
} from "@/components/lge-dashboard";
import VerticalBar from "../../../../../components/lge-dashboard/chart/VerticalBar";
import {apiTrendBuy} from "@/config/sample.data";
const PurchasePage = () => {
const displayRowLabel = (i:number, rowLabel: string) => {
if (rowLabel === "gap") return "전년 대비 GAP(%)";
return rowLabel;
};
const purchaseTableRows: TopChartTableRow[] = apiTrendBuy.map((row, i) => ({
label: displayRowLabel(i, row.rowLabel),
values: PRODUCT_KEYS.map((k) => (row as any)[k] ?? null),
}));
const purchaseChartData: ChartData = {
categories: [...PRODUCTS], // 한글 라벨(세탁기/냉장고/...)
series: apiTrendBuy
.filter((r) => r.rowLabel.endsWith("년")) // 24년/25년/26년만 차트에 사용
.map((r) => ({
name: r.rowLabel, // legend: 24년/25년/26년
data: PRODUCT_KEYS.map((k) => (r as any)[k] ?? null),
})),
}
return (
<div>PurchasePage</div>
<div>
<TopChartTable
title={"전체 구매율"}
categories={[...PRODUCTS]}
rows={purchaseTableRows}
chart={
<VerticalBar
data={purchaseChartData}
paletteVarNames={["--chart-3", "--chart-2", "--chart-1"]}
grid={GRID_X_NOT_PADDING}
xAxis={{ type: "category", data: [...PRODUCTS], ...AXIS_HIDE_STYLE }}
yAxis={{ type: "value", ...AXIS_HIDE_STYLE }}
showFocusLabel={"last"}
height={260}
/>
}
signStyle={signStyleGapRow}
/>
</div>
);
}