Files
frontend/apps/dm/components/Lnb.tsx
T

68 lines
1.9 KiB
TypeScript

"use client";
export type LnbMenuItem = {
label: string;
href: string;
};
export type LnbConfig = {
title: string;
menus: LnbMenuItem[];
};
export const LNB_MAP = {
intro: {
title: "소개",
menus: [
{ label: "물 재이용 법", href: "/intro/law" },
{ label: "빗물 이용시설", href: "/intro/rain" },
{ label: "중수도", href: "/intro/reuseWater" },
{ label: "하수처리수", href: "/intro/treated" },
],
},
status: {
title: "현황",
menus: [
{ label: "빗물이용시설(현황)", href: "/status/rain" },
{ label: "중수도(현황)", href: "/status/greywater" },
{ label: "하수처리수 재이용시설(현황)", href: "/status/sewage" },
],
},
case: {
title: "사례",
menus: [
{ label: "빗물 재이용 사례", href: "/example/rain" },
{ label: "중수 재이용 사례", href: "/example/greywater" },
{ label: "하수 재이용 사례", href: "/example/sewage" },
{ label: "해외 재이용 사례", href: "/example/globalCase" },
],
},
apply: {
title: "수요신청",
menus: [
{ label: "수요처등록", href: "/apply/dmdco" },
{ label: "수요정보등록", href: "/apply/register" },
{ label: "수요신청현황", href: "/apply/status" },
],
},
} satisfies Record<string, LnbConfig>;
export function getCategory(pathname: string): keyof typeof LNB_MAP {
if (pathname.startsWith("/intro")) return "intro";
if (pathname.startsWith("/status")) return "status";
if (pathname.startsWith("/example")) return "case";
if (pathname.startsWith("/apply")) return "apply";
return "intro";
}
export function isActiveMenu(pathname: string, href: string) {
return pathname === href || pathname.startsWith(`${href}/`);
}
// 왼쪽 메뉴는 더 이상 사용 안 함
export default function Lnb() {
return null;
}