From c961cca2cf2f4065c1427e821ed02e60f77f276f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 27 Aug 2018 13:40:15 +0800 Subject: [PATCH] add settings drawer i18n --- package.json | 2 +- src/components/SettingDarwer/ThemeColor.js | 4 +-- src/components/SettingDarwer/index.js | 34 ++++++++++++---------- src/layouts/BasicLayout.js | 7 ++++- src/locales/en-US.js | 13 +++++++++ src/locales/zh-CN.js | 13 +++++++++ 6 files changed, 53 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 601d5723..fdc790f2 100755 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@babel/polyfill": "^7.0.0-beta.53", "@types/react": "^16.4.11", "@types/react-dom": "^16.0.6", - "antd-pro-merge-less": "^0.0.6", + "antd-pro-merge-less": "^0.0.9", "antd-theme-webpack-plugin": "^1.0.8", "babel-eslint": "^8.2.6", "babel-runtime": "^6.9.2", diff --git a/src/components/SettingDarwer/ThemeColor.js b/src/components/SettingDarwer/ThemeColor.js index 63bf4782..f70bd4f8 100644 --- a/src/components/SettingDarwer/ThemeColor.js +++ b/src/components/SettingDarwer/ThemeColor.js @@ -15,7 +15,7 @@ const Tag = ({ color, check, ...rest }) => { ); }; -const ThemeColor = ({ colors, value, onChange }) => { +const ThemeColor = ({ colors, title, value, onChange }) => { let colorList = colors; if (!colors) { colorList = [ @@ -31,7 +31,7 @@ const ThemeColor = ({ colors, value, onChange }) => { } return (
-

主题色

+

{title}

{colorList.map(color => { return ( diff --git a/src/components/SettingDarwer/index.js b/src/components/SettingDarwer/index.js index 074bce0c..3a5802d3 100644 --- a/src/components/SettingDarwer/index.js +++ b/src/components/SettingDarwer/index.js @@ -1,5 +1,6 @@ import React, { PureComponent } from 'react'; import { Select, message, Drawer, List, Switch, Divider, Icon, Button } from 'antd'; +import { formatMessage } from 'umi/locale'; import { CopyToClipboard } from 'react-copy-to-clipboard'; import { connect } from 'dva'; import styles from './index.less'; @@ -26,7 +27,7 @@ class SettingDarwer extends PureComponent { } = this.props; return [ { - title: '栅格模式', + title: formatMessage({ id: 'app.setting.gridmode' }), action: [ , ], }, { - title: '固定 Header', + title: formatMessage({ id: 'app.setting.fixedheader' }), action: [
- + this.changeSetting('themeColor', color)} /> - + - + , ]} > - 色弱模式 + {formatMessage({ id: 'app.setting.weakmode' })} - message.success( - 'copy success,please replace defaultSetting in src/models/setting.js' - ) - } + onCopy={() => message.success(formatMessage({ id: 'app.setting.copyinfo' }))} >
diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 14299d2c..c96e64d8 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -179,7 +179,12 @@ class BasicLayout extends React.PureComponent { {...this.props} /> )} - +
{children}