diff --git a/src/components/MainLayout/Header.js b/src/components/MainLayout/Header.js new file mode 100644 index 0000000..72d4737 --- /dev/null +++ b/src/components/MainLayout/Header.js @@ -0,0 +1,28 @@ +import React from 'react'; +import { Menu, Icon } from 'antd'; +import { Link } from 'dva/router'; + +function Header({ location }) { + return ( + + + Users + + + Home + + + 404 + + + dva + + + ); +} + +export default Header; diff --git a/src/components/MainLayout/MainLayout.css b/src/components/MainLayout/MainLayout.css new file mode 100644 index 0000000..24e81e9 --- /dev/null +++ b/src/components/MainLayout/MainLayout.css @@ -0,0 +1,16 @@ + +.normal { + display: flex; + flex-direction: column; + height: 100%; +} + +.content { + flex: 1; + display: flex; +} + +.main { + padding: 0 8px; + flex: 1 0 auto; +} diff --git a/src/components/MainLayout/MainLayout.js b/src/components/MainLayout/MainLayout.js new file mode 100644 index 0000000..cc08ab8 --- /dev/null +++ b/src/components/MainLayout/MainLayout.js @@ -0,0 +1,18 @@ +import React from 'react'; +import styles from './MainLayout.css'; +import Header from './Header'; + +function MainLayout({ children, location }) { + return ( +
+
+
+
+ {children} +
+
+
+ ); +} + +export default MainLayout; diff --git a/src/routes/IndexPage.js b/src/routes/IndexPage.js index c591acb..139a444 100644 --- a/src/routes/IndexPage.js +++ b/src/routes/IndexPage.js @@ -1,17 +1,20 @@ import React from 'react'; import { connect } from 'dva'; import styles from './IndexPage.css'; +import MainLayout from '../components/MainLayout/MainLayout'; -function IndexPage() { +function IndexPage({ location }) { return ( -
-

Yay! Welcome to dva!

-
- -
+ +
+

Yay! Welcome to dva!

+
+
    +
  • To get started, edit src/index.js and save to reload.
  • +
  • Getting Started
  • +
+
+ ); } diff --git a/src/routes/Users.css b/src/routes/Users.css index 3224ee4..561f3b4 100644 --- a/src/routes/Users.css +++ b/src/routes/Users.css @@ -1,3 +1,5 @@ - -.normal { -} + +.normal { + width: 900px; + margin: 3em auto 0; +} diff --git a/src/routes/Users.js b/src/routes/Users.js index a4419c7..d442fa6 100644 --- a/src/routes/Users.js +++ b/src/routes/Users.js @@ -2,12 +2,15 @@ import React from 'react'; import { connect } from 'dva'; import styles from './Users.css'; import UsersComponent from '../components/Users/Users'; +import MainLayout from '../components/MainLayout/MainLayout'; -function Users() { +function Users({ location }) { return ( -
- -
+ +
+ +
+
); }