From 8c74bc6cf62fc19a916338b380374aef1afb8914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Sun, 1 Jul 2018 14:07:25 +0800 Subject: [PATCH] Weak mode changed to switch --- functions/package.json | 2 +- package.json | 6 ++-- src/components/SettingDarwer/index.js | 52 +++++++++++++-------------- src/models/setting.js | 2 +- 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/functions/package.json b/functions/package.json index 6bf16a42..5e142869 100644 --- a/functions/package.json +++ b/functions/package.json @@ -7,7 +7,7 @@ "start": "npm run shell", "deploy": "firebase deploy --only functions", "logs": "firebase functions:log", - "mock":"cd .. && rollup -c" + "mock": "cd .. && rollup -c" }, "dependencies": { "express": "^4.16.3", diff --git a/package.json b/package.json index 5bd0a6c6..8750db9d 100755 --- a/package.json +++ b/package.json @@ -5,11 +5,11 @@ "private": true, "scripts": { "precommit": "npm run lint-staged", - "preinstall": "cd functions && npm install", + "presite": "cd functions && npm install", "start": "cross-env ESLINT=none roadhog dev", "start:no-proxy": "cross-env NO_PROXY=true ESLINT=none roadhog dev", "build": "cross-env ESLINT=none roadhog build", - "site": "rollup -c && npm run build && firebase deploy", + "site": "npm run presite && rollup -c && npm run build && firebase deploy", "analyze": "cross-env ANALYZE=1 roadhog build", "lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint": "eslint --ext .js src mock tests && npm run lint:style", @@ -38,7 +38,7 @@ "path-to-regexp": "^2.1.0", "prop-types": "^15.5.10", "qs": "^6.5.0", - "rc-drawer": "^1.4.4", + "rc-drawer": "^1.5.1", "react": "^16.4.0", "react-container-query": "^0.11.0", "react-document-title": "^2.0.3", diff --git a/src/components/SettingDarwer/index.js b/src/components/SettingDarwer/index.js index 79aa11b2..e11595ed 100644 --- a/src/components/SettingDarwer/index.js +++ b/src/components/SettingDarwer/index.js @@ -106,7 +106,7 @@ class SettingDarwer extends PureComponent { } } if (key === 'colorWeak') { - if (value === 'open') { + if (value) { document.body.className = 'colorWeak'; } else { document.body.className = ''; @@ -155,24 +155,26 @@ class SettingDarwer extends PureComponent { open={collapse} mask={false} onHandleClick={this.togglerContent} - handleChild={ - !collapse ? ( - - ) : ( - - ) + handler={ +
+ {!collapse ? ( + + ) : ( + + )} +
} placement="right" width="336px" @@ -231,15 +233,11 @@ class SettingDarwer extends PureComponent { this.changeSetting('colorWeak', value)} - style={{ width: 80 }} - > - close - open - , + checked={!!colorWeak} + onChange={checked => this.changeSetting('colorWeak', checked)} + />, ]} > 色弱模式 diff --git a/src/models/setting.js b/src/models/setting.js index 72b7caca..77b21a0c 100644 --- a/src/models/setting.js +++ b/src/models/setting.js @@ -7,7 +7,7 @@ const defaultSetting = { fixedHeader: false, autoHideHeader: false, fixSiderbar: false, - colorWeak: 'close', + colorWeak: false, }; export default { -- GitLab