ant-design/components/menu/demo/extra-style.tsx
EmilyyyLiu 47eb1b661e
feat(Space): unify orientation attribute usage (#53669)
* feat[Space]:Unified use of orientation attribute

* feat: use useOrientation and change doc, add test

* feat: add warning

* test: update snapshots

* Update components/space/Compact.tsx

Co-authored-by: thinkasany <480968828@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* test: reset snapshots,delete direction default value

* feat: change demo direnction->orentation

* feat: demos direction ->orientation

* feat: add vertical, and change demos , doc

* feat: change demo space -> flex

* feat: change demo space -> flex

* feat: space -> flex

* Update components/space/index.tsx

Signed-off-by: thinkasany <480968828@qq.com>

* Update components/space/Compact.tsx

Signed-off-by: thinkasany <480968828@qq.com>

* add warning toHaveBeenCalledWith

---------

Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>
Signed-off-by: thinkasany <480968828@qq.com>
Co-authored-by: 刘欢 <lh01217311@antgroup.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-05-23 15:20:33 +08:00

56 lines
1.2 KiB
TypeScript

import React from 'react';
import { DownOutlined, MailOutlined } from '@ant-design/icons';
import type { MenuProps } from 'antd';
import { Flex, Menu, Space } from 'antd';
type MenuItem = Required<MenuProps>['items'][number];
const items1: MenuItem[] = [
{
key: 'sub1',
icon: <MailOutlined />,
label: 'Navigation One',
children: [
{
key: '1',
label: (
<Flex justify="space-between">
<span>Option 1</span>
<DownOutlined />
</Flex>
),
},
{
key: '2',
label: 'Option 2',
extra: '⌘P',
},
{
key: '3',
label: <a href="https://www.baidu.com">Link Option</a>,
disabled: true,
},
],
},
];
const items2: MenuItem[] = [
{ key: '1', label: 'Users', extra: '⌘U' },
{ key: '2', label: 'Profile', extra: '⌘P' },
];
const App: React.FC = () => (
<Space vertical>
<Menu
mode="inline"
defaultOpenKeys={['sub1']}
defaultSelectedKeys={['1']}
style={{ width: 256 }}
items={items1}
/>
<Menu theme="dark" style={{ width: 256 }} items={items2} />
</Space>
);
export default App;