Commit 55b6eef9 authored by afc163's avatar afc163

Add screen reponsive className

parent 76f9865b
...@@ -6,6 +6,8 @@ import { connect } from 'dva'; ...@@ -6,6 +6,8 @@ import { connect } from 'dva';
import { Link, routerRedux, Route, Redirect, Switch } from 'dva/router'; import { Link, routerRedux, Route, Redirect, Switch } from 'dva/router';
import moment from 'moment'; import moment from 'moment';
import groupBy from 'lodash/groupBy'; import groupBy from 'lodash/groupBy';
import { ContainerQuery } from 'react-container-query';
import classNames from 'classnames';
import styles from './BasicLayout.less'; import styles from './BasicLayout.less';
import HeaderSearch from '../components/HeaderSearch'; import HeaderSearch from '../components/HeaderSearch';
import NoticeIcon from '../components/NoticeIcon'; import NoticeIcon from '../components/NoticeIcon';
...@@ -16,6 +18,27 @@ import { getRouteData } from '../utils/utils'; ...@@ -16,6 +18,27 @@ import { getRouteData } from '../utils/utils';
const { Header, Sider, Content } = Layout; const { Header, Sider, Content } = Layout;
const { SubMenu } = Menu; const { SubMenu } = Menu;
const query = {
'screen-xs': {
maxWidth: 575,
},
'screen-sm': {
minWidth: 576,
maxWidth: 767,
},
'screen-md': {
minWidth: 768,
maxWidth: 991,
},
'screen-lg': {
minWidth: 992,
maxWidth: 1199,
},
'screen-xl': {
minWidth: 1200,
},
};
class BasicLayout extends React.PureComponent { class BasicLayout extends React.PureComponent {
static childContextTypes = { static childContextTypes = {
location: PropTypes.object, location: PropTypes.object,
...@@ -211,8 +234,7 @@ class BasicLayout extends React.PureComponent { ...@@ -211,8 +234,7 @@ class BasicLayout extends React.PureComponent {
openKeys: this.state.openKeys, openKeys: this.state.openKeys,
}; };
return ( const layout = (
<DocumentTitle title={this.getPageTitle()}>
<Layout> <Layout>
<Sider <Sider
trigger={null} trigger={null}
...@@ -339,6 +361,13 @@ class BasicLayout extends React.PureComponent { ...@@ -339,6 +361,13 @@ class BasicLayout extends React.PureComponent {
</Content> </Content>
</Layout> </Layout>
</Layout> </Layout>
);
return (
<DocumentTitle title={this.getPageTitle()}>
<ContainerQuery query={query}>
{params => <div className={classNames(params)}>{layout}</div>}
</ContainerQuery>
</DocumentTitle> </DocumentTitle>
); );
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment