2022-11-09 12:28:04 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { LaptopOutlined, NotificationOutlined, UserOutlined } from '@ant-design/icons';
|
|
|
|
import type { MenuProps } from 'antd';
|
2022-12-05 14:06:42 +08:00
|
|
|
import { Breadcrumb, Layout, Menu, theme } from 'antd';
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
|
|
const { Header, Content, Sider } = Layout;
|
|
|
|
|
2022-11-19 13:47:33 +08:00
|
|
|
const items1: MenuProps['items'] = ['1', '2', '3'].map((key) => ({
|
2022-11-09 12:28:04 +08:00
|
|
|
key,
|
|
|
|
label: `nav ${key}`,
|
|
|
|
}));
|
|
|
|
|
|
|
|
const items2: MenuProps['items'] = [UserOutlined, LaptopOutlined, NotificationOutlined].map(
|
|
|
|
(icon, index) => {
|
|
|
|
const key = String(index + 1);
|
|
|
|
|
|
|
|
return {
|
|
|
|
key: `sub${key}`,
|
|
|
|
icon: React.createElement(icon),
|
|
|
|
label: `subnav ${key}`,
|
|
|
|
|
|
|
|
children: new Array(4).fill(null).map((_, j) => {
|
|
|
|
const subKey = index * 4 + j + 1;
|
|
|
|
return {
|
|
|
|
key: subKey,
|
|
|
|
label: `option${subKey}`,
|
|
|
|
};
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
2022-12-05 14:06:42 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const {
|
2023-12-11 12:22:23 +08:00
|
|
|
token: { colorBgContainer, borderRadiusLG },
|
2022-12-05 14:06:42 +08:00
|
|
|
} = theme.useToken();
|
|
|
|
|
|
|
|
return (
|
2022-11-09 12:28:04 +08:00
|
|
|
<Layout>
|
2023-05-11 20:00:00 +08:00
|
|
|
<Header style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
|
<div className="demo-logo" />
|
2023-12-11 12:22:23 +08:00
|
|
|
<Menu
|
|
|
|
theme="dark"
|
|
|
|
mode="horizontal"
|
|
|
|
defaultSelectedKeys={['2']}
|
|
|
|
items={items1}
|
|
|
|
style={{ flex: 1, minWidth: 0 }}
|
|
|
|
/>
|
2022-12-05 14:06:42 +08:00
|
|
|
</Header>
|
|
|
|
<Layout>
|
|
|
|
<Sider width={200} style={{ background: colorBgContainer }}>
|
|
|
|
<Menu
|
|
|
|
mode="inline"
|
|
|
|
defaultSelectedKeys={['1']}
|
|
|
|
defaultOpenKeys={['sub1']}
|
|
|
|
style={{ height: '100%', borderRight: 0 }}
|
|
|
|
items={items2}
|
|
|
|
/>
|
|
|
|
</Sider>
|
|
|
|
<Layout style={{ padding: '0 24px 24px' }}>
|
|
|
|
<Breadcrumb style={{ margin: '16px 0' }}>
|
|
|
|
<Breadcrumb.Item>Home</Breadcrumb.Item>
|
|
|
|
<Breadcrumb.Item>List</Breadcrumb.Item>
|
|
|
|
<Breadcrumb.Item>App</Breadcrumb.Item>
|
|
|
|
</Breadcrumb>
|
|
|
|
<Content
|
|
|
|
style={{
|
|
|
|
padding: 24,
|
|
|
|
margin: 0,
|
|
|
|
minHeight: 280,
|
|
|
|
background: colorBgContainer,
|
2023-12-11 12:22:23 +08:00
|
|
|
borderRadius: borderRadiusLG,
|
2022-12-05 14:06:42 +08:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
Content
|
|
|
|
</Content>
|
|
|
|
</Layout>
|
2022-11-09 12:28:04 +08:00
|
|
|
</Layout>
|
|
|
|
</Layout>
|
2022-12-05 14:06:42 +08:00
|
|
|
);
|
|
|
|
};
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
|
|
export default App;
|