From 3e127cc85414b16f6b6166fd059dd180b5d47abb Mon Sep 17 00:00:00 2001 From: jim Date: Thu, 3 May 2018 01:06:31 +0800 Subject: [PATCH] fix fixSiderbar --- package.json | 18 +++++++++--------- src/components/Sidebar/ThemeColor.less | 1 + src/components/Sidebar/index.js | 2 +- src/components/Sidebar/index.less | 1 + src/components/SiderMenu/SiderMenu.js | 6 ++++-- src/components/SiderMenu/index.js | 2 +- src/components/TopNavHeader/index.js | 17 +++-------------- src/components/TopNavHeader/index.less | 4 ++-- src/models/setting.js | 2 +- 9 files changed, 23 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 0857677d..ed465dde 100755 --- a/package.json +++ b/package.json @@ -31,11 +31,11 @@ "bizcharts-plugin-slider": "^2.0.3", "classnames": "^2.2.5", "dva": "^2.2.3", - "dva-loading": "^1.0.4", + "dva-loading": "^2.0.1", "enquire-js": "^0.2.1", - "less": "2.7.2", + "less": "3.0.2", "lodash": "^4.17.4", - "lodash-decorators": "^4.4.1", + "lodash-decorators": "^5.0.0", "moment": "^2.22.0", "numeral": "^2.0.6", "omit.js": "^1.0.0", @@ -44,7 +44,7 @@ "qs": "^6.5.0", "rc-drawer-menu": "^0.5.0", "react": "^16.3.1", - "react-container-query": "^0.9.1", + "react-container-query": "^0.11.0", "react-document-title": "^2.0.3", "react-dom": "^16.3.1", "react-fittext": "^1.0.0", @@ -64,7 +64,7 @@ "eslint": "^4.14.0", "eslint-config-airbnb": "^16.0.0", "eslint-config-prettier": "^2.9.0", - "eslint-plugin-babel": "^4.0.0", + "eslint-plugin-babel": "^5.1.0", "eslint-plugin-compat": "^2.1.0", "eslint-plugin-import": "^2.8.0", "eslint-plugin-jsx-a11y": "^6.0.3", @@ -72,15 +72,15 @@ "eslint-plugin-react": "^7.0.1", "gh-pages": "^1.0.0", "husky": "^0.14.3", - "lint-staged": "^6.0.0", + "lint-staged": "^7.0.5", "mockjs": "^1.0.1-beta3", - "prettier": "1.11.1", + "prettier": "1.12.1", "pro-download": "^1.0.1", "redbox-react": "^1.5.0", "regenerator-runtime": "^0.11.1", "roadhog": "^2.3.0", "roadhog-api-doc": "^1.0.2", - "stylelint": "^8.4.0", + "stylelint": "^9.2.0", "stylelint-config-prettier": "^3.0.4", "stylelint-config-standard": "^18.0.0" }, @@ -92,7 +92,7 @@ "prettier --wirter", "git add" ], - "**/*.{js,jsx}": "lint-staged:js", + "**/*.{js,jsx}": "npm run lint-staged:js", "**/*.less": "stylelint --syntax less" }, "engines": { diff --git a/src/components/Sidebar/ThemeColor.less b/src/components/Sidebar/ThemeColor.less index 9dd141b4..e9e802f6 100644 --- a/src/components/Sidebar/ThemeColor.less +++ b/src/components/Sidebar/ThemeColor.less @@ -14,6 +14,7 @@ height: 16px; border-radius: 2px; float: left; + cursor: pointer; margin: 5px; &.active { width: 18px; diff --git a/src/components/Sidebar/index.js b/src/components/Sidebar/index.js index a68b0b30..3635912f 100644 --- a/src/components/Sidebar/index.js +++ b/src/components/Sidebar/index.js @@ -156,7 +156,7 @@ class Sidebar extends PureComponent { - + diff --git a/src/components/Sidebar/index.less b/src/components/Sidebar/index.less index 44188567..3ce62d07 100644 --- a/src/components/Sidebar/index.less +++ b/src/components/Sidebar/index.less @@ -55,6 +55,7 @@ width: 38px; height: 22px; margin: 4px; + cursor: pointer; margin-right: 12px; display: inline-block; vertical-align: middle; diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 1cfb1a9a..176b5f66 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -13,7 +13,9 @@ const { SubMenu } = Menu; * @memberof SiderMenu */ const getDefaultCollapsedSubMenus = props => { - const { location: { pathname } } = props; + const { + location: { pathname }, + } = props; return urlToList(pathname) .map(item => { return getMenuMatches(props.flatMenuKeys, item)[0]; @@ -140,7 +142,7 @@ export default class SiderMenu extends PureComponent { breakpoint="lg" onCollapse={onCollapse} width={256} - className={`${styles.sider} ${theme === 'ligth' ? styles.ligth : ''}`} + className={`${styles.sider} ${theme === 'light' ? styles.light : ''}`} >
diff --git a/src/components/SiderMenu/index.js b/src/components/SiderMenu/index.js index 3ec398b2..8b73a38e 100644 --- a/src/components/SiderMenu/index.js +++ b/src/components/SiderMenu/index.js @@ -20,7 +20,7 @@ const getFlatMenuKeys = menuData => { }; const SiderMenuWrapper = props => - props.isMobile ? ( + props.isMobile || props.fixSiderbar ? ( -
+
+
@@ -24,10 +16,7 @@ export default class TopNavHeader extends PureComponent {

Ant Design Pro

- +
diff --git a/src/components/TopNavHeader/index.less b/src/components/TopNavHeader/index.less index 456fc548..681c6ef7 100644 --- a/src/components/TopNavHeader/index.less +++ b/src/components/TopNavHeader/index.less @@ -5,7 +5,7 @@ padding: 0 12px 0 0; box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08); position: relative; - &.ligth { + &.light { background-color: #fff; } .main { @@ -46,7 +46,7 @@ } } -.ligth { +.light { h1 { color: #002140; } diff --git a/src/models/setting.js b/src/models/setting.js index 783ff344..fe9fdb03 100644 --- a/src/models/setting.js +++ b/src/models/setting.js @@ -20,7 +20,7 @@ export default { Object.keys(state).forEach(key => { if (urlParams.searchParams.has(key)) { const value = urlParams.searchParams.get(key); - setting[key] = value; + setting[key] = value === '1' ? true : '1'; } }); return setting; -- GitLab