260209_01_ENH: 테이블에 단위 텍스트 추가, 하단 설명 추가
This commit is contained in:
@@ -6,6 +6,7 @@ import type { DataColumn, SignStyle } from "../types";
|
||||
import SectionTitle from "../SectionTitle";
|
||||
import { TABLE_DIMENSIONS } from "@/const/chartConst";
|
||||
import {isSampleRow} from "@/lib/lg-dashboard";
|
||||
import {SAMPLE_SIZE_NOTICE, UNIT_TEXT} from "@/const/lgConst";
|
||||
|
||||
type MergedChartCell<T> = {
|
||||
/** 차트를 삽입할 컬럼 key(해당 컬럼 td는 startRow에서만 렌더되고 rowSpan 적용) */
|
||||
@@ -34,6 +35,7 @@ type Props<T extends Record<string, unknown>> = {
|
||||
tableClassName?: string;
|
||||
minWidthPx?: number;
|
||||
starUnder30Sample?: boolean;
|
||||
unitText?: string;
|
||||
};
|
||||
|
||||
// toNumber는 utils.ts의 parseNumber로 통합됨
|
||||
@@ -67,7 +69,8 @@ export default function LeftChartTable<T extends Record<string, unknown>>({
|
||||
wrapperClassName,
|
||||
tableClassName,
|
||||
minWidthPx = TABLE_DIMENSIONS.MIN_WIDTH.COMPACT,
|
||||
starUnder30Sample = true
|
||||
starUnder30Sample = true,
|
||||
unitText = UNIT_TEXT,
|
||||
}: Props<T>) {
|
||||
const hasGroupHeader = useMemo(
|
||||
() => columns.some((c) => c.group) || columns.some((c) => c.headRowSpan === 2),
|
||||
@@ -137,9 +140,16 @@ export default function LeftChartTable<T extends Record<string, unknown>>({
|
||||
|
||||
return (
|
||||
<div className={cn("w-full", wrapperClassName)}>
|
||||
{title && (
|
||||
<SectionTitle title={title} />
|
||||
)}
|
||||
<div className="mb-2 flex items-center justify-between">
|
||||
{ title && <SectionTitle title={title} />}
|
||||
{
|
||||
(unitText || starUnder30Sample) &&
|
||||
<div className="ml-auto text-gray-500 content-text-xs font-semibold text-right">
|
||||
{unitText}
|
||||
{starUnder30Sample && <><br/>{SAMPLE_SIZE_NOTICE}</>}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div className="overflow-x-auto">
|
||||
<table className={cn("lg-table", tableClassName)} style={{ minWidth: `${minWidthPx}px` }}>
|
||||
|
||||
Reference in New Issue
Block a user