Skip to content

Commit 251f2e0

Browse files
committed
antd layout
1 parent e1219ad commit 251f2e0

File tree

4 files changed

+31
-28
lines changed

4 files changed

+31
-28
lines changed

umi/config/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
[
77
'umi-plugin-react',
88
{
9-
antd: false,
9+
antd: true,
1010
dva: true,
1111
dynamicImport: false,
1212
title: 'umi',

umi/package.json

+5-12
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,15 @@
44
"start": "umi dev",
55
"build": "umi build",
66
"test": "umi test",
7-
87
"lint": "eslint --ext .js src mock tests",
9-
10-
118
"precommit": "lint-staged"
129
},
1310
"dependencies": {
14-
1511
"dva": "^2.5.0-beta.2",
16-
17-
1812
"react": "^16.7.0",
1913
"react-dom": "^16.7.0"
2014
},
2115
"devDependencies": {
22-
2316
"babel-eslint": "^9.0.0",
2417
"eslint": "^5.4.0",
2518
"eslint-config-umi": "^1.4.0",
@@ -30,14 +23,14 @@
3023
"husky": "^0.14.3",
3124
"lint-staged": "^7.2.2",
3225
"react-test-renderer": "^16.7.0",
33-
3426
"umi": "^2.6.3",
3527
"umi-plugin-react": "^1.6.0"
36-
37-
},
28+
},
3829
"lint-staged": {
39-
40-
"*.{js,jsx}": ["eslint --fix", "git add"]
30+
"*.{js,jsx}": [
31+
"eslint --fix",
32+
"git add"
33+
]
4134
},
4235
"engines": {
4336
"node": ">=8.0.0"

umi/src/layouts/index.js

+22-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
1-
import styles from './index.css';
1+
import { Menu, Icon } from 'antd';
2+
import Link from 'umi/link';
3+
import withRouter from 'umi/withRouter';
24

3-
function BasicLayout(props) {
5+
function layout({ children, location }) {
46
return (
5-
<div className={styles.normal}>
6-
<h1 className={styles.title}>Another day, Another dollor.</h1>
7-
<ul className={styles.nav}>
8-
<li>
9-
<a href="/"> index</a>
10-
</li>
11-
<li>
12-
<a href="/todos"> Todos</a>
13-
</li>
14-
</ul>
15-
{props.children}
7+
<div>
8+
<Menu selectedKeys={[location.pathname]} mode="horizontal" theme="dark">
9+
<Menu.Item key="/">
10+
<Link to="/">
11+
<Icon type="home" />
12+
Home
13+
</Link>
14+
</Menu.Item>
15+
16+
<Menu.Item key="/todos">
17+
<Link to="/todos">
18+
<Icon type="bars" />
19+
Todos
20+
</Link>
21+
</Menu.Item>
22+
</Menu>
23+
{children}
1624
</div>
1725
);
1826
}
1927

20-
export default BasicLayout;
28+
export default withRouter(layout);

umi/src/pages/todos/index.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
.todoClose {
2727
float: right;
2828
border-radius: 50%;
29-
margin-left: 1rem;
29+
font-size: 1px;
30+
border: none;
31+
background-color: grey;
3032
}
3133

3234
.todoInsert {

0 commit comments

Comments
 (0)