Files
factorio-clusterio/packages/web_ui/src/components/PageLayout.tsx
T
Danielv123 8879f8dd80 Replaced react Link with custom component
The custom component merges the behaviour of antd Typography.Link and the react-router.dom Link after the custom component prop was removed in v6 according to this guide: https://reactrouter.com/en/main/upgrading/v5#remove-link-component-prop
2024-02-09 09:11:53 +03:00

30 lines
650 B
TypeScript

import React from "react";
import { Layout, Breadcrumb } from "antd";
import Link from "./Link";
const { Content } = Layout;
type PageLayoutProps = {
nav: {
path?: string;
name: string;
}[];
children?: any;
};
export default function PageLayout(props: PageLayoutProps) {
return <>
<Breadcrumb
className="site-breadcrumb"
itemRender={(route, params, routes, paths) => (
route.href ? <Link to={route.href}>{route.title}</Link> : route.title
)}
items={props.nav.map(
(part, index) => ({ href: part.path, title: part.name }))
}
/>
<Content className="site-layout-content" >
{props.children}
</Content>
</>;
}