PageHeaderLayout.js 758 Bytes
Newer Older
1
import React from 'react';
偏右's avatar
偏右 committed
2
import { Link } from 'dva/router';
3
import PageHeader from '../components/PageHeader';
jim's avatar
jim committed
4
import GridContent from './GridContent';
afc163's avatar
afc163 committed
5
import styles from './PageHeaderLayout.less';
6
import MenuContext from './MenuContext';
7

Erwin Zhang's avatar
Erwin Zhang committed
8
const PageHeaderLayout = ({ children, wrapperClassName, top, ...restProps }) => (
afc163's avatar
afc163 committed
9
  <div style={{ margin: '-24px -24px 0' }} className={wrapperClassName}>
nikogu's avatar
nikogu committed
10
    {top}
jim's avatar
jim committed
11
    <MenuContext.Consumer>
jim's avatar
jim committed
12 13 14
      {value => {
        return <PageHeader {...value} key="pageheader" {...restProps} linkElement={Link} />;
      }}
jim's avatar
jim committed
15
    </MenuContext.Consumer>
jim's avatar
jim committed
16 17 18 19 20
    {children ? (
      <div className={styles.content}>
        <GridContent>{children}</GridContent>
      </div>
    ) : null}
21 22
  </div>
);
Erwin Zhang's avatar
Erwin Zhang committed
23 24

export default PageHeaderLayout;