Skip to content

Commit

Permalink
step 6 添加 Header Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivocin committed Sep 8, 2018
1 parent 7696926 commit d700852
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
28 changes: 28 additions & 0 deletions src/layouts/Header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Menu, Icon } from 'antd';
import Link from 'umi/link';
function Header({ location }) {
return (
<Menu
selectedKeys={[location.pathname]}
mode="horizontal"
theme="dark"
>
<Menu.Item key="/">
<Link to="/"><Icon type="home" />Home</Link>
</Menu.Item>
<Menu.Item key="/users">
<Link to="/users"><Icon type="bars" />Users</Link>
</Menu.Item>
<Menu.Item key="/umi">
<a href="https://github.com/umijs/umi" target="_blank" rel="noopener noreferrer">umi</a>
</Menu.Item>
<Menu.Item key="/dva">
<a href="https://github.com/dvajs/dva" target="_blank" rel="noopener noreferrer">dva</a>
</Menu.Item>
<Menu.Item key="/404">
<Link to="/page-you-dont-know"><Icon type="frown" />404</Link>
</Menu.Item>
</Menu>
);
}
export default Header;
3 changes: 2 additions & 1 deletion src/layouts/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Header from './Header';
import styles from './index.css';

function BasicLayout(props) {
return (
<div className={styles.normal}>
<h1 className={styles.title}>Yay! Welcome to umi!</h1>
<Header location={props.location}/>
{ props.children }
</div>
);
Expand Down

0 comments on commit d700852

Please sign in to comment.