forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: horizontal Menu style with (ant-design#40105)
* fix: horizontal Menu style with * chore: update snapshot * chore: code clean
- Loading branch information
Showing
8 changed files
with
682 additions
and
14 deletions.
There are no files selected for viewing
406 changes: 406 additions & 0 deletions
406
components/menu/__tests__/__snapshots__/demo-extend.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## zh-CN | ||
|
||
水平的顶部导航菜单。 | ||
|
||
## en-US | ||
|
||
Horizontal top navigation menu. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React, { useState } from 'react'; | ||
import { AppstoreOutlined, MailOutlined, SettingOutlined } from '@ant-design/icons'; | ||
import type { MenuProps } from 'antd'; | ||
import { Menu } from 'antd'; | ||
|
||
const items: MenuProps['items'] = [ | ||
{ | ||
label: 'Navigation One', | ||
key: 'mail', | ||
icon: <MailOutlined />, | ||
}, | ||
{ | ||
label: 'Navigation Two', | ||
key: 'app', | ||
icon: <AppstoreOutlined />, | ||
disabled: true, | ||
}, | ||
{ | ||
label: 'Navigation Three - Submenu', | ||
key: 'SubMenu', | ||
icon: <SettingOutlined />, | ||
children: [ | ||
{ | ||
type: 'group', | ||
label: 'Item 1', | ||
children: [ | ||
{ | ||
label: 'Option 1', | ||
key: 'setting:1', | ||
}, | ||
{ | ||
label: 'Option 2', | ||
key: 'setting:2', | ||
}, | ||
], | ||
}, | ||
{ | ||
type: 'group', | ||
label: 'Item 2', | ||
children: [ | ||
{ | ||
label: 'Option 3', | ||
key: 'setting:3', | ||
}, | ||
{ | ||
label: 'Option 4', | ||
key: 'setting:4', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
label: ( | ||
<a href="https://ant.design" target="_blank" rel="noopener noreferrer"> | ||
Navigation Four - Link | ||
</a> | ||
), | ||
key: 'alipay', | ||
}, | ||
]; | ||
|
||
const App: React.FC = () => { | ||
const [current, setCurrent] = useState('mail'); | ||
|
||
const onClick: MenuProps['onClick'] = (e) => { | ||
console.log('click ', e); | ||
setCurrent(e.key); | ||
}; | ||
|
||
return ( | ||
<Menu onClick={onClick} selectedKeys={[current]} mode="horizontal" items={items} theme="dark" /> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters