From 77ed923fba22eebbd0d7bcd13811b83bf5b66e5a Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 16 Jul 2020 13:46:57 +0800 Subject: [PATCH] docs: :clapper: import Modal demo --- .../__tests__/__snapshots__/demo.test.js.snap | 297 ++++++++++++++++++ components/modal/__tests__/demo.test.js | 3 + components/modal/demo/async.md | 4 +- components/modal/demo/basic.md | 4 +- components/modal/demo/button-props.md | 4 +- components/modal/demo/confirm-router.md | 7 +- components/modal/demo/dark.md | 64 ++-- components/modal/demo/footer.md | 4 +- components/modal/demo/hooks.md | 4 +- components/modal/demo/locale.md | 4 +- components/modal/demo/position.md | 4 +- 11 files changed, 354 insertions(+), 45 deletions(-) create mode 100644 components/modal/__tests__/__snapshots__/demo.test.js.snap create mode 100644 components/modal/__tests__/demo.test.js diff --git a/components/modal/__tests__/__snapshots__/demo.test.js.snap b/components/modal/__tests__/__snapshots__/demo.test.js.snap new file mode 100644 index 0000000000..6c3f75ff2f --- /dev/null +++ b/components/modal/__tests__/__snapshots__/demo.test.js.snap @@ -0,0 +1,297 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders ./components/modal/demo/async.md correctly 1`] = ` + +`; + +exports[`renders ./components/modal/demo/basic.md correctly 1`] = ` + +`; + +exports[`renders ./components/modal/demo/button-props.md correctly 1`] = ` + +`; + +exports[`renders ./components/modal/demo/confirm.md correctly 1`] = ` +
+
+ +
+
+ +
+
+ +
+
+ +
+
+`; + +exports[`renders ./components/modal/demo/confirm-router.md correctly 1`] = ` + +`; + +exports[`renders ./components/modal/demo/dark.md correctly 1`] = ` + +`; + +exports[`renders ./components/modal/demo/footer.md correctly 1`] = ` + +`; + +exports[`renders ./components/modal/demo/hooks.md correctly 1`] = ` +
+
+ +
+
+ +
+
+ +
+
+ +
+
+`; + +exports[`renders ./components/modal/demo/info.md correctly 1`] = ` +
+
+ +
+
+ +
+
+ +
+
+ +
+
+`; + +exports[`renders ./components/modal/demo/locale.md correctly 1`] = ` +
+ +
+ +
+`; + +exports[`renders ./components/modal/demo/manual.md correctly 1`] = ` + +`; + +exports[`renders ./components/modal/demo/position.md correctly 1`] = ` +Array [ + , +
, +
, + , +] +`; diff --git a/components/modal/__tests__/demo.test.js b/components/modal/__tests__/demo.test.js new file mode 100644 index 0000000000..65333d266b --- /dev/null +++ b/components/modal/__tests__/demo.test.js @@ -0,0 +1,3 @@ +import demoTest from '../../../tests/shared/demoTest'; + +demoTest('modal'); diff --git a/components/modal/demo/async.md b/components/modal/demo/async.md index e45a0abfbf..c30273e6b3 100644 --- a/components/modal/demo/async.md +++ b/components/modal/demo/async.md @@ -52,7 +52,7 @@ class App extends React.Component { render() { const { visible, confirmLoading, ModalText } = this.state; return ( -
+ <> @@ -65,7 +65,7 @@ class App extends React.Component { >

{ModalText}

-
+ ); } } diff --git a/components/modal/demo/basic.md b/components/modal/demo/basic.md index 0bce8d1522..504876bf5a 100644 --- a/components/modal/demo/basic.md +++ b/components/modal/demo/basic.md @@ -41,7 +41,7 @@ class App extends React.Component { render() { return ( -
+ <> @@ -55,7 +55,7 @@ class App extends React.Component {

Some contents...

Some contents...

-
+ ); } } diff --git a/components/modal/demo/button-props.md b/components/modal/demo/button-props.md index 39543dc0bd..aa5be2605f 100644 --- a/components/modal/demo/button-props.md +++ b/components/modal/demo/button-props.md @@ -41,7 +41,7 @@ class App extends React.Component { render() { return ( -
+ <> @@ -57,7 +57,7 @@ class App extends React.Component {

Some contents...

Some contents...

-
+ ); } } diff --git a/components/modal/demo/confirm-router.md b/components/modal/demo/confirm-router.md index b6486a9797..27c3fbde80 100644 --- a/components/modal/demo/confirm-router.md +++ b/components/modal/demo/confirm-router.md @@ -40,10 +40,5 @@ function showConfirm() { } } -ReactDOM.render( -
- -
, - mountNode, -); +ReactDOM.render(, mountNode); ``` diff --git a/components/modal/demo/dark.md b/components/modal/demo/dark.md index fd321486eb..f504857274 100644 --- a/components/modal/demo/dark.md +++ b/components/modal/demo/dark.md @@ -15,7 +15,25 @@ debug: true Basic modal. ```jsx -import { Modal, DatePicker, Slider, Tree, Badge, Collapse, Timeline, Tabs, Anchor, Table, Card, Button, Calendar, Transfer, Switch, Typography, Dropdown } from 'antd'; +import { + Modal, + DatePicker, + Slider, + Tree, + Badge, + Collapse, + Timeline, + Tabs, + Anchor, + Table, + Card, + Button, + Calendar, + Transfer, + Switch, + Typography, + Dropdown, +} from 'antd'; import moment from 'moment'; import difference from 'lodash/difference'; import { DownOutlined, ClockCircleOutlined } from '@ant-design/icons'; @@ -287,15 +305,15 @@ class App extends React.Component { showSearch: false, }; - handleDisable = (disabled) => { + handleDisable = disabled => { this.setState({ disabled, - }) - } + }); + }; handleTableTransferChange = nextTargetKeys => { this.setState({ targetKeys: nextTargetKeys }); - } + }; triggerDisable = disabled => { this.setState({ disabled }); @@ -305,7 +323,7 @@ class App extends React.Component { this.setState({ showSearch }); }; - handleTransferChange = (nextTargetKeys) => { + handleTransferChange = nextTargetKeys => { this.setState({ targetKeys: nextTargetKeys }); }; @@ -374,7 +392,7 @@ class App extends React.Component { }, ]; return ( -
+ <> @@ -391,11 +409,9 @@ class App extends React.Component { onChange={this.handleDisable} style={{ marginBottom: 16 }} /> - + Content - - Content - + Content Content Content Content @@ -470,7 +486,11 @@ class App extends React.Component { - + @@ -496,11 +516,7 @@ class App extends React.Component { Network problems being solved 2015-09-01 - } - defaultExpandedKeys={['0-0-0']} - > + } defaultExpandedKeys={['0-0-0']}> @@ -517,7 +533,7 @@ class App extends React.Component { 'Footer'} /> -

-
+
} + cover={ + example + } > @@ -573,7 +587,7 @@ class App extends React.Component { - + ); } } diff --git a/components/modal/demo/footer.md b/components/modal/demo/footer.md index 7542099883..b749c69346 100644 --- a/components/modal/demo/footer.md +++ b/components/modal/demo/footer.md @@ -46,7 +46,7 @@ class App extends React.Component { render() { const { visible, loading } = this.state; return ( -
+ <> @@ -70,7 +70,7 @@ class App extends React.Component {

Some contents...

Some contents...

-
+ ); } } diff --git a/components/modal/demo/hooks.md b/components/modal/demo/hooks.md index 268217b301..7b8d4246f4 100644 --- a/components/modal/demo/hooks.md +++ b/components/modal/demo/hooks.md @@ -22,11 +22,11 @@ const UnreachableContext = React.createContext(); const config = { title: 'Use Hook!', content: ( -
+ <> {name => `Reachable: ${name}!`}
{name => `Unreachable: ${name}!`} -
+ ), }; diff --git a/components/modal/demo/locale.md b/components/modal/demo/locale.md index 5bc8b08509..278ce3b86d 100644 --- a/components/modal/demo/locale.md +++ b/components/modal/demo/locale.md @@ -34,7 +34,7 @@ class LocalizedModal extends React.Component { render() { return ( -
+ <> @@ -50,7 +50,7 @@ class LocalizedModal extends React.Component {

Bla bla ...

Bla bla ...

-
+ ); } } diff --git a/components/modal/demo/position.md b/components/modal/demo/position.md index 6b10571097..1afbc0ead2 100644 --- a/components/modal/demo/position.md +++ b/components/modal/demo/position.md @@ -32,7 +32,7 @@ class App extends React.Component { render() { return ( -
+ <> @@ -63,7 +63,7 @@ class App extends React.Component {

some contents...

some contents...

-
+ ); } }