mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
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
30 lines
650 B
TypeScript
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>
|
|
</>;
|
|
}
|