260209_01_ENH: 테이블에 단위 텍스트 추가, 하단 설명 추가
This commit is contained in:
@@ -31,7 +31,7 @@ const buildDefaultTotalValue = (): SelectedMap => {
|
||||
return init;
|
||||
};
|
||||
|
||||
export const buildDefaultCategoryValue = (categoryFilterItems: ProductsFilterItem): CategoryFilterValue => {
|
||||
const buildDefaultCategoryValue = (categoryFilterItems: ProductsFilterItem): CategoryFilterValue => {
|
||||
const initProduct = categoryFilterItems.items[0];
|
||||
const initType = {label:"보유", value:CategoryTargetType.PENETRATION}
|
||||
const firstTarget = categoryTarget.find((x) => x.type.includes(initType.value))?.children?.[0]?.target;
|
||||
@@ -45,6 +45,12 @@ export const buildDefaultCategoryValue = (categoryFilterItems: ProductsFilterIte
|
||||
};
|
||||
};
|
||||
|
||||
const buildTotalPartDescription = (pathname:string) => {
|
||||
return pathname.match("penetration")
|
||||
? "■ 보급률: 전체 소비자 중, 조사 년도에 해당 제품을 <strong>보유하고 있는 비율</strong>"
|
||||
: "■ 구매율: 전체 소비자 중, 조사 년도에 해당 제품을 <strong>구매한 비율</strong>";
|
||||
}
|
||||
|
||||
const MainLayout = ({ children }: MainLayoutProps) => {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
@@ -62,6 +68,7 @@ const MainLayout = ({ children }: MainLayoutProps) => {
|
||||
const isFilterOpen = isTotal ? isTotalFilterOpen : isCategoryFilterOpen;
|
||||
|
||||
const categoryFilterItems = PRODUCTS_FILTER_ITEM.find((m) => pathname.match?.(m.path)) ?? PRODUCTS_FILTER_ITEM[0];
|
||||
const totalPartDescription = buildTotalPartDescription(pathname);
|
||||
|
||||
const [totalValue, setTotalValue] = useState<SelectedMap>(() => buildDefaultTotalValue());
|
||||
const [categoryValue, setCategoryValue] = useState<CategoryFilterValue>(() => buildDefaultCategoryValue(categoryFilterItems));
|
||||
@@ -137,16 +144,15 @@ const MainLayout = ({ children }: MainLayoutProps) => {
|
||||
type="button"
|
||||
onClick={toggleFilter}
|
||||
className={cn(
|
||||
"inline-flex items-center gap-2 font-semibold text-gray-900 content-text-sm",
|
||||
"inline-flex items-center gap-2 font-semibold text-gray-900 content-text-sm cursor-pointer",
|
||||
"select-none"
|
||||
)}
|
||||
>
|
||||
<Filter className="h-4 w-4 fill-[hsl(var(--lg-gray-500))] stroke-[hsl(var(--lg-gray-500))]" />
|
||||
필터 <span className="text-sm leading-none">{isFilterOpen ? "▲" : "▼"}</span>
|
||||
필터 <span className="text-sm leading-none mb-1">{isFilterOpen ? "▲" : "▼"}</span>
|
||||
</button>
|
||||
{isTotal && (
|
||||
<div className={"ml-5 content-text-sm"}>
|
||||
페이지에 대한 설명
|
||||
<div className={"ml-5 content-text-sm"} dangerouslySetInnerHTML={{__html: totalPartDescription}}>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user