Commit e0cf86a3 authored by jim's avatar jim

Increase color weakness

parent 55946fb2
...@@ -12,7 +12,7 @@ class Bar extends Component { ...@@ -12,7 +12,7 @@ class Bar extends Component {
}; };
componentDidMount() { componentDidMount() {
window.addEventListener('resize', this.resize); window.addEventListener('resize', this.resize, { passive: true });
} }
componentWillUnmount() { componentWillUnmount() {
......
...@@ -19,7 +19,7 @@ export default class Pie extends Component { ...@@ -19,7 +19,7 @@ export default class Pie extends Component {
}; };
componentDidMount() { componentDidMount() {
window.addEventListener('resize', this.resize); window.addEventListener('resize', this.resize, { passive: true });
} }
componentDidUpdate(preProps) { componentDidUpdate(preProps) {
......
...@@ -23,7 +23,7 @@ class TagCloud extends Component { ...@@ -23,7 +23,7 @@ class TagCloud extends Component {
this.initTagCloud(); this.initTagCloud();
this.renderChart(); this.renderChart();
}); });
window.addEventListener('resize', this.resize); window.addEventListener('resize', this.resize, { passive: true });
} }
componentDidUpdate(preProps) { componentDidUpdate(preProps) {
......
...@@ -17,7 +17,7 @@ export default class WaterWave extends PureComponent { ...@@ -17,7 +17,7 @@ export default class WaterWave extends PureComponent {
this.renderChart(); this.renderChart();
this.resize(); this.resize();
}); });
window.addEventListener('resize', this.resize); window.addEventListener('resize', this.resize, { passive: true });
} }
componentWillUnmount() { componentWillUnmount() {
......
...@@ -12,7 +12,7 @@ export default class GlobalHeaderRight extends PureComponent { ...@@ -12,7 +12,7 @@ export default class GlobalHeaderRight extends PureComponent {
if (notices.length === 0) { if (notices.length === 0) {
return {}; return {};
} }
const newNotices = notices.map((notice) => { const newNotices = notices.map(notice => {
const newNotice = { ...notice }; const newNotice = { ...notice };
if (newNotice.datetime) { if (newNotice.datetime) {
newNotice.datetime = moment(notice.datetime).fromNow(); newNotice.datetime = moment(notice.datetime).fromNow();
...@@ -69,15 +69,15 @@ export default class GlobalHeaderRight extends PureComponent { ...@@ -69,15 +69,15 @@ export default class GlobalHeaderRight extends PureComponent {
className = `${styles.right} ${styles.dark}`; className = `${styles.right} ${styles.dark}`;
} }
return ( return (
<div className={className} > <div className={className}>
<HeaderSearch <HeaderSearch
className={`${styles.action} ${styles.search}`} className={`${styles.action} ${styles.search}`}
placeholder="站内搜索" placeholder="站内搜索"
dataSource={['搜索提示一', '搜索提示二', '搜索提示三']} dataSource={['搜索提示一', '搜索提示二', '搜索提示三']}
onSearch={(value) => { onSearch={value => {
console.log('input', value); // eslint-disable-line console.log('input', value); // eslint-disable-line
}} }}
onPressEnter={(value) => { onPressEnter={value => {
console.log('enter', value); // eslint-disable-line console.log('enter', value); // eslint-disable-line
}} }}
/> />
...@@ -87,6 +87,7 @@ export default class GlobalHeaderRight extends PureComponent { ...@@ -87,6 +87,7 @@ export default class GlobalHeaderRight extends PureComponent {
href="http://pro.ant.design/docs/getting-started" href="http://pro.ant.design/docs/getting-started"
rel="noopener noreferrer" rel="noopener noreferrer"
className={styles.action} className={styles.action}
title="使用文档"
> >
<Icon type="question-circle-o" /> <Icon type="question-circle-o" />
</a> </a>
...@@ -124,11 +125,7 @@ export default class GlobalHeaderRight extends PureComponent { ...@@ -124,11 +125,7 @@ export default class GlobalHeaderRight extends PureComponent {
{currentUser.name ? ( {currentUser.name ? (
<Dropdown overlay={menu}> <Dropdown overlay={menu}>
<span className={`${styles.action} ${styles.account}`}> <span className={`${styles.action} ${styles.account}`}>
<Avatar <Avatar size="small" className={styles.avatar} src={currentUser.avatar} />
size="small"
className={styles.avatar}
src={currentUser.avatar}
/>
<span className={styles.name}>{currentUser.name}</span> <span className={styles.name}>{currentUser.name}</span>
</span> </span>
</Dropdown> </Dropdown>
......
...@@ -75,10 +75,10 @@ export default class HeaderSearch extends PureComponent { ...@@ -75,10 +75,10 @@ export default class HeaderSearch extends PureComponent {
onChange={this.onChange} onChange={this.onChange}
> >
<Input <Input
placeholder={placeholder}
ref={node => { ref={node => {
this.input = node; this.input = node;
}} }}
placeholder={placeholder}
onKeyDown={this.onKeyDown} onKeyDown={this.onKeyDown}
onBlur={this.leaveSearchMode} onBlur={this.leaveSearchMode}
/> />
......
...@@ -21,10 +21,13 @@ const Body = ({ children, title, style }) => ( ...@@ -21,10 +21,13 @@ const Body = ({ children, title, style }) => (
@connect(({ setting }) => ({ setting })) @connect(({ setting }) => ({ setting }))
class SettingDarwer extends PureComponent { class SettingDarwer extends PureComponent {
componentDidMount() { componentDidMount() {
const { themeColor } = this.props.setting; const { themeColor, colorWeak } = this.props.setting;
if (themeColor !== '#1890FF') { if (themeColor !== '#1890FF') {
this.colorChange(themeColor); this.colorChange(themeColor);
} }
if (colorWeak === 'open') {
document.body.className = 'colorWeak';
}
} }
getLayOutSetting = () => { getLayOutSetting = () => {
const { grid, fixedHeader, autoHideHeader, fixSiderbar } = this.props.setting; const { grid, fixedHeader, autoHideHeader, fixSiderbar } = this.props.setting;
...@@ -85,6 +88,13 @@ class SettingDarwer extends PureComponent { ...@@ -85,6 +88,13 @@ class SettingDarwer extends PureComponent {
nextState.grid = 'Fluid'; nextState.grid = 'Fluid';
} }
} }
if (key === 'colorWeak') {
if (value === 'open') {
document.body.className = 'colorWeak';
} else {
document.body.className = '';
}
}
this.setState(nextState, () => { this.setState(nextState, () => {
this.props.dispatch({ this.props.dispatch({
type: 'setting/changeSetting', type: 'setting/changeSetting',
...@@ -112,7 +122,7 @@ class SettingDarwer extends PureComponent { ...@@ -112,7 +122,7 @@ class SettingDarwer extends PureComponent {
}, 200); }, 200);
}; };
render() { render() {
const { collapse, silderTheme, themeColor, layout } = this.props.setting; const { collapse, silderTheme, themeColor, layout, colorWeak } = this.props.setting;
return ( return (
<div className={styles.settingDarwer}> <div className={styles.settingDarwer}>
<div className={styles.mini_bar} onClick={this.togglerContent}> <div className={styles.mini_bar} onClick={this.togglerContent}>
...@@ -177,6 +187,26 @@ class SettingDarwer extends PureComponent { ...@@ -177,6 +187,26 @@ class SettingDarwer extends PureComponent {
dataSource={this.getLayOutSetting()} dataSource={this.getLayOutSetting()}
renderItem={item => <List.Item actions={item.action}>{item.title}</List.Item>} renderItem={item => <List.Item actions={item.action}>{item.title}</List.Item>}
/> />
<Divider />
<Body title="导航设置 ">
<List.Item
actions={[
<Select
value={colorWeak}
size="small"
onSelect={value => this.changeSetting('colorWeak', value)}
style={{ width: 80 }}
>
<Select.Option value="close">close</Select.Option>
<Select.Option value="open">open</Select.Option>
</Select>,
]}
>
色弱模式
</List.Item>
</Body>
</div> </div>
</DrawerMenu> </DrawerMenu>
</div> </div>
......
...@@ -5,6 +5,10 @@ body, ...@@ -5,6 +5,10 @@ body,
overflow: auto; overflow: auto;
} }
:global(.colorWeak) {
filter: invert(80%);
}
:global(.ant-layout) { :global(.ant-layout) {
min-height: 100%; min-height: 100%;
} }
......
...@@ -62,7 +62,7 @@ class AdvancedForm extends PureComponent { ...@@ -62,7 +62,7 @@ class AdvancedForm extends PureComponent {
width: '100%', width: '100%',
}; };
componentDidMount() { componentDidMount() {
window.addEventListener('resize', this.resizeFooterToolbar); window.addEventListener('resize', this.resizeFooterToolbar, { passive: true });
} }
componentWillUnmount() { componentWillUnmount() {
window.removeEventListener('resize', this.resizeFooterToolbar); window.removeEventListener('resize', this.resizeFooterToolbar);
......
...@@ -197,7 +197,7 @@ export default class AdvancedProfile extends Component { ...@@ -197,7 +197,7 @@ export default class AdvancedProfile extends Component {
}); });
this.setStepDirection(); this.setStepDirection();
window.addEventListener('resize', this.setStepDirection); window.addEventListener('resize', this.setStepDirection, { passive: true });
} }
componentWillUnmount() { componentWillUnmount() {
......
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