260209_01_ENH: 테이블에 단위 텍스트 추가, 하단 설명 추가
This commit is contained in:
@@ -5,7 +5,8 @@ import type React from "react";
|
||||
import { cn, parseNumber } from "@/lib/utils";
|
||||
import type { DataColumn, SignDisplayMode, SignStyle } from "../types";
|
||||
import SectionTitle from "../SectionTitle";
|
||||
import {isSampleRow} from "@/lib/lg-dashboard";
|
||||
import {isCagrRow, isSampleRow} from "@/lib/lg-dashboard";
|
||||
import {SAMPLE_SIZE_NOTICE, UNIT_TEXT} from "@/const/lgConst";
|
||||
|
||||
type Props<T extends Record<string, unknown>> = {
|
||||
columns: DataColumn<T>[];
|
||||
@@ -15,7 +16,9 @@ type Props<T extends Record<string, unknown>> = {
|
||||
wrapperClassName?: string;
|
||||
signStyle?: SignStyle<T>;
|
||||
fillGreaterThan5?: boolean;
|
||||
fillCAGR?: boolean;
|
||||
starUnder30Sample?: boolean;
|
||||
unitText?: string;
|
||||
};
|
||||
|
||||
// parseSignedNumber는 utils.ts의 parseNumber로 통합됨
|
||||
@@ -57,7 +60,9 @@ const DataTable = <T extends Record<string, unknown>>({
|
||||
wrapperClassName,
|
||||
signStyle,
|
||||
fillGreaterThan5 = false,
|
||||
fillCAGR = false,
|
||||
starUnder30Sample = false,
|
||||
unitText = UNIT_TEXT,
|
||||
}: Props<T>) => {
|
||||
const hasGroup = columns.some((c) => !!c.group) || columns.some((c) => c.headRowSpan === 2);
|
||||
|
||||
@@ -148,9 +153,16 @@ const DataTable = <T extends Record<string, unknown>>({
|
||||
|
||||
return (
|
||||
<div className={cn("w-full overflow-x-auto", 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>
|
||||
<table className={cn("lg-table", className)}>
|
||||
<thead>
|
||||
{hasGroup && (
|
||||
|
||||
Reference in New Issue
Block a user