From d1308e4acab1dc18011eb28d853fb7044856104e Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 1 Sep 2018 22:22:29 +0800 Subject: [PATCH] refactor code --- src/components/SettingDrawer/index.js | 37 ++++++++------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/src/components/SettingDrawer/index.js b/src/components/SettingDrawer/index.js index 5d5eae07..10e989ed 100644 --- a/src/components/SettingDrawer/index.js +++ b/src/components/SettingDrawer/index.js @@ -84,16 +84,9 @@ class SettingDrawer extends PureComponent { const nextState = { ...setting }; nextState[key] = value; if (key === 'layout') { - if (value === 'topmenu') { - nextState.grid = 'Wide'; - } else { - nextState.grid = 'Fluid'; - } - } - if (key === 'fixedHeader') { - if (!value) { - nextState.autoHideHeader = false; - } + nextState.grid = value === 'topmenu' ? 'Wide' : 'Fluid'; + } else if (key === 'fixedHeader' && !value) { + nextState.autoHideHeader = false; } this.setState(nextState, () => { const { dispatch } = this.props; @@ -120,23 +113,13 @@ class SettingDrawer extends PureComponent { placement="right" handler={
- {!collapse ? ( - - ) : ( - - )} +
} onHandleClick={this.togglerContent} -- GitLab