mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-22 22:48:29 +08:00
e8fa5938ab
* site: use CSS logical properties * Update components/anchor/demo/targetOffset.tsx Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: lijianan <574980606@qq.com> * fix: fix * fix: fix * chore: fix * fix: add more * fix: add more --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: afc163 <afc163@gmail.com>
88 lines
2.4 KiB
TypeScript
88 lines
2.4 KiB
TypeScript
import React from 'react';
|
|
import { LaptopOutlined, NotificationOutlined, UserOutlined } from '@ant-design/icons';
|
|
import type { MenuProps } from 'antd';
|
|
import { Breadcrumb, ConfigProvider, Layout, Menu, theme } from 'antd';
|
|
|
|
const { Header, Content, Sider } = Layout;
|
|
|
|
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}`,
|
|
};
|
|
}),
|
|
};
|
|
},
|
|
);
|
|
|
|
const App: React.FC = () => {
|
|
const {
|
|
token: { colorBgContainer, colorBgLayout, borderRadiusLG },
|
|
} = theme.useToken();
|
|
|
|
return (
|
|
<ConfigProvider
|
|
theme={{
|
|
components: {
|
|
Layout: {
|
|
bodyBg: '#fff',
|
|
headerBg: '#1677ff',
|
|
headerHeight: 64,
|
|
headerPadding: `0 24px`,
|
|
headerColor: colorBgContainer,
|
|
siderBg: colorBgContainer,
|
|
},
|
|
},
|
|
}}
|
|
>
|
|
<Layout>
|
|
<Header style={{ display: 'flex', alignItems: 'center' }}>
|
|
<div className="demo-logo" />
|
|
<div style={{ marginInlineStart: 24, fontSize: 24 }}>Ant Design</div>
|
|
</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: colorBgLayout,
|
|
borderRadius: borderRadiusLG,
|
|
}}
|
|
>
|
|
Content
|
|
</Content>
|
|
</Layout>
|
|
</Layout>
|
|
</Layout>
|
|
</ConfigProvider>
|
|
);
|
|
};
|
|
|
|
export default App;
|