This commit is contained in:
seb
2026-06-23 11:40:09 +02:00
parent f8b9ceab9c
commit 8c3e70d383
7 changed files with 156 additions and 28 deletions

View File

@@ -1,10 +1,20 @@
import Typography from '@mui/material/Typography';
import { Outlet, useLocation } from 'react-router-dom';
import PageLayout from '../components/PageLayout';
import { NAV_ITEMS, SUB_NAV } from '../nav';
export default function SectionPage({ sectionPath, children }) {
const { pathname } = useLocation();
const title = NAV_ITEMS.find((item) => item.path === sectionPath)?.label ?? '';
const subNav = SUB_NAV[sectionPath];
const activeSub = subNav?.find((item) => {
const subPath = item.segment ? `${sectionPath}/${item.segment}` : sectionPath;
return pathname === subPath || pathname === `${subPath}/`;
});
const pageTitle = activeSub && subNav ? activeSub.label : title;
export default function SectionPage({ title }) {
return (
<PageLayout title={title}>
<Typography color="text.secondary">Inhalt folgt.</Typography>
<PageLayout title={pageTitle} subNav={subNav} basePath={sectionPath}>
{children ?? <Outlet />}
</PageLayout>
);
}

9
src/pages/SubPage.jsx Normal file
View File

@@ -0,0 +1,9 @@
import Typography from '@mui/material/Typography';
export default function SubPage({ title, description }) {
return (
<Typography color="text.secondary">
{description ?? `${title} — Inhalt folgt.`}
</Typography>
);
}