From 76afe5037d8efdd8a47a32af51fef769f3d435f2 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 5 Aug 2018 14:28:39 +0800 Subject: [PATCH] demo: improve drawer demo and test case code --- .../drawer/__tests__/MultiDrawer.test.js | 2 +- components/drawer/demo/basic-left.md | 6 --- components/drawer/demo/basic-right.md | 7 --- components/drawer/demo/from-drawer.md | 15 ++----- components/drawer/demo/multi-level-drawer.md | 9 +--- components/drawer/demo/user-profile.md | 44 ++++++++----------- components/drawer/index.en-US.md | 6 +++ components/drawer/index.zh-CN.md | 6 +++ 8 files changed, 36 insertions(+), 59 deletions(-) diff --git a/components/drawer/__tests__/MultiDrawer.test.js b/components/drawer/__tests__/MultiDrawer.test.js index f1abfccc15..266cdea656 100644 --- a/components/drawer/__tests__/MultiDrawer.test.js +++ b/components/drawer/__tests__/MultiDrawer.test.js @@ -40,7 +40,7 @@ class MultiDrawer extends React.Component { , mountNode); ``` - - diff --git a/components/drawer/demo/basic-right.md b/components/drawer/demo/basic-right.md index 0efa947b47..69084e4096 100644 --- a/components/drawer/demo/basic-right.md +++ b/components/drawer/demo/basic-right.md @@ -55,10 +55,3 @@ class App extends React.Component { ReactDOM.render(, mountNode); ``` - - - \ No newline at end of file diff --git a/components/drawer/demo/from-drawer.md b/components/drawer/demo/from-drawer.md index 3aa0e7d821..b832ef2e25 100644 --- a/components/drawer/demo/from-drawer.md +++ b/components/drawer/demo/from-drawer.md @@ -28,11 +28,9 @@ class DrawerForm extends React.Component { }; onClose = () => { - this.setState( - { - visible: false, - } - ); + this.setState({ + visible: false, + }); }; render() { @@ -174,13 +172,8 @@ class DrawerForm extends React.Component { ); } } + const App = Form.create()(DrawerForm); ReactDOM.render(, mountNode); ``` - - \ No newline at end of file diff --git a/components/drawer/demo/multi-level-drawer.md b/components/drawer/demo/multi-level-drawer.md index 5146537786..c64dfd7fde 100644 --- a/components/drawer/demo/multi-level-drawer.md +++ b/components/drawer/demo/multi-level-drawer.md @@ -52,13 +52,12 @@ class App extends React.Component { , mountNode); ``` - - diff --git a/components/drawer/demo/user-profile.md b/components/drawer/demo/user-profile.md index a12e416cbd..f472e6f31c 100644 --- a/components/drawer/demo/user-profile.md +++ b/components/drawer/demo/user-profile.md @@ -24,29 +24,27 @@ const pStyle = { marginBottom: 16, }; -const DescriptionItem = ({ title, content }) => { - return ( -
( +
+

-

- {title}: -

- {content} -
- ); -}; + {title}: +

+ {content} +
+); class App extends React.Component { state = { visible: false }; @@ -185,9 +183,3 @@ class App extends React.Component { ReactDOM.render(, mountNode); ``` - - \ No newline at end of file diff --git a/components/drawer/index.en-US.md b/components/drawer/index.en-US.md index 5238273547..2b7bfc60b5 100644 --- a/components/drawer/index.en-US.md +++ b/components/drawer/index.en-US.md @@ -31,3 +31,9 @@ A Drawer is a panel that is typically overlaid on top of a page and slides in fr | zIndex | The `z-index` of the Drawer. | Number | 1000 | | placement | The placement of the Drawer. | 'left' \| 'right' | 'right' | onClose | Specify a callback that will be called when a user clicks mask, close button or Cancel button. | function(e) | - | + + diff --git a/components/drawer/index.zh-CN.md b/components/drawer/index.zh-CN.md index 001bc72307..e1ac2987cb 100644 --- a/components/drawer/index.zh-CN.md +++ b/components/drawer/index.zh-CN.md @@ -32,3 +32,9 @@ title: Drawer | zIndex | 设置 Drawer 的 `z-index` | Number | 1000 | | placement | 抽屉的方向 | 'left' \| 'right' | 'right' | onClose | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | 无 | + +