From 85e9fa710a4fdcd93f30d6c517dddb5a51b23db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Wed, 4 Jul 2018 11:00:08 +0800 Subject: [PATCH] Add copy setting button look #1751 --- package.json | 1 + src/components/SettingDarwer/index.js | 198 +++++++++++++----------- src/components/SettingDarwer/index.less | 9 ++ 3 files changed, 114 insertions(+), 94 deletions(-) diff --git a/package.json b/package.json index 4b370ca6..03ec7e39 100755 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "qs": "^6.5.2", "rc-drawer": "^1.5.2", "react-container-query": "^0.11.0", + "react-copy-to-clipboard": "^5.0.1", "react-document-title": "^2.0.3", "react-fittext": "^1.0.0", "rollbar": "^2.3.4", diff --git a/src/components/SettingDarwer/index.js b/src/components/SettingDarwer/index.js index d3950294..891e37de 100644 --- a/src/components/SettingDarwer/index.js +++ b/src/components/SettingDarwer/index.js @@ -1,6 +1,7 @@ import React, { PureComponent } from 'react'; import { Select, message, List, Switch, Divider, Icon } from 'antd'; import DrawerMenu from 'rc-drawer'; +import { CopyToClipboard } from 'react-copy-to-clipboard'; import { connect } from 'dva'; import styles from './index.less'; import ThemeColor from './ThemeColor'; @@ -145,108 +146,117 @@ class SettingDarwer extends PureComponent { }; render() { - const { - setting: { collapse, silderTheme, themeColor, layout, colorWeak }, - } = this.props; + const { setting } = this.props; + const { collapse, silderTheme, themeColor, layout, colorWeak } = setting; return ( -
- - {!collapse ? ( - - ) : ( - - )} -
- } - placement="right" - width="336px" - style={{ - zIndex: 999, - }} - onMaskClick={this.togglerContent} - > -
- - this.changeSetting('silderTheme', value)} + + {!collapse ? ( + - - - + ) : ( + + )} +
+ } + placement="right" + width="336px" + style={{ + zIndex: 999, + }} + onMaskClick={this.togglerContent} + > +
+ message.success('copy success')} + > +
+ Copy To Clipboard +
+
+ + this.changeSetting('silderTheme', value)} + /> + - + - - this.changeSetting('layout', value)} - /> - + - {item.title}} + + this.changeSetting('layout', value)} /> + - + {item.title}} + /> - - this.changeSetting('colorWeak', checked)} - />, - ]} - > - 色弱模式 - - -
- - + + + + this.changeSetting('colorWeak', checked)} + />, + ]} + > + 色弱模式 + + + + ); } } diff --git a/src/components/SettingDarwer/index.less b/src/components/SettingDarwer/index.less index 972a9091..4a21f999 100644 --- a/src/components/SettingDarwer/index.less +++ b/src/components/SettingDarwer/index.less @@ -5,6 +5,15 @@ min-height: 100%; padding: 24px; background: #fff; + position: relative; + .clipboard { + position: absolute; + top: 10px; + right: 10px; + cursor: pointer; + width: 16px; + height: 16px; + } } .blockChecbox { -- GitLab