From d54996449303e95319e60f63b13f0acb58ab146c Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Wed, 18 Jan 2023 19:20:40 +0800 Subject: [PATCH] demo: update demo (#40313) * demo: update demo * add * fix lint --- components/card/demo/basic.md | 7 - .../__snapshots__/demo-extend.test.ts.snap | 7233 +++++++++-------- .../__tests__/__snapshots__/demo.test.ts.snap | 2171 ++--- components/select/demo/basic.tsx | 48 +- components/select/demo/big-data.tsx | 1 + components/select/demo/coordinate.tsx | 7 +- components/select/demo/debug.md | 25 +- components/select/demo/debug.tsx | 74 +- components/select/demo/multiple.tsx | 8 +- components/select/demo/option-label-prop.md | 6 - components/select/demo/option-label-prop.tsx | 18 +- components/select/demo/size.md | 14 - components/select/demo/size.tsx | 57 +- components/select/demo/status.md | 6 - components/select/demo/suffix.md | 4 +- components/select/demo/suffix.tsx | 34 +- components/select/index.en-US.md | 6 +- components/select/index.zh-CN.md | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 426 +- .../__tests__/__snapshots__/demo.test.ts.snap | 398 +- components/slider/demo/basic.md | 6 - components/slider/demo/input-number.tsx | 11 +- components/slider/demo/vertical.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 64 +- .../__tests__/__snapshots__/demo.test.ts.snap | 64 +- components/switch/demo/basic.md | 6 - components/switch/demo/disabled.tsx | 7 +- docs/react/introduce.en-US.md | 1 + docs/react/introduce.zh-CN.md | 1 + 29 files changed, 5427 insertions(+), 5284 deletions(-) diff --git a/components/card/demo/basic.md b/components/card/demo/basic.md index bdaf622ffa..7c9b4014ca 100644 --- a/components/card/demo/basic.md +++ b/components/card/demo/basic.md @@ -5,10 +5,3 @@ ## en-US A basic card containing a title, content and an extra corner content. Supports two sizes: `default` and `small`. - - diff --git a/components/select/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/select/__tests__/__snapshots__/demo-extend.test.ts.snap index 9f947cead9..526b61e2b3 100644 --- a/components/select/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/select/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -381,148 +381,156 @@ exports[`renders ./components/select/demo/automatic-tokenization.tsx extend cont `; exports[`renders ./components/select/demo/basic.tsx extend context correctly 1`] = ` -Array [ +
- - - - - Lucy - -
-
-
-
+ + + + + Lucy + +
+
+
+
- jack +
+ jack +
+
+ lucy +
- lucy -
-
-
-
-
-
+
+
- Jack +
+ Jack +
+
-
-
- Lucy +
+ Lucy +
+
-
-
- Disabled +
+ yiminghe +
+
-
-
- yiminghe +
+ Disabled +
+
-
@@ -530,118 +538,123 @@ Array [
-
- - -
, +
+
- - - - - Lucy - -
-
-
-
+ + + + + Lucy + +
+
+
+
- lucy +
+ lucy +
-
-
-
-
+
+
- Lucy +
+ Lucy +
+
-
@@ -649,116 +662,121 @@ Array [
-
- - -
, +
+
- - - - - Lucy - -
-
-
-
+ + + + + Lucy + +
+
+
+
- lucy +
+ lucy +
-
-
-
-
+
+
- Lucy +
+ Lucy +
+
-
@@ -766,116 +784,121 @@ Array [
-
- - -
, +
+
- - - - - Lucy - -
-
-
-
+ + + + + Lucy + +
+
+
+
- lucy +
+ lucy +
-
-
-
-
+
+
- Lucy +
+ Lucy +
+
-
@@ -883,61 +906,61 @@ Array [
+ +
- - -
, -] +
+
`; exports[`renders ./components/select/demo/bordered.tsx extend context correctly 1`] = ` @@ -1224,114 +1247,122 @@ Array [ `; exports[`renders ./components/select/demo/coordinate.tsx extend context correctly 1`] = ` -Array [ +
- - - - - Zhejiang - -
-
-
-
+ + + + + Zhejiang + +
+
+
+
- Zhejiang +
+ Zhejiang +
+
+ Jiangsu +
- Jiangsu -
-
-
-
-
-
+
+
- Zhejiang +
+ Zhejiang +
+
-
-
- Jiangsu +
+ Jiangsu +
+
-
@@ -1339,158 +1370,163 @@ Array [
-
- - -
, +
+
- - - - - Hangzhou - -
-
-
-
+ + + + + Hangzhou + +
+
+
+
- Hangzhou +
+ Hangzhou +
+
+ Ningbo +
- Ningbo -
-
-
-
-
-
+
+
- Hangzhou +
+ Hangzhou +
+
-
-
- Ningbo +
+ Ningbo +
+
-
-
- Wenzhou +
+ Wenzhou +
+
-
@@ -1498,35 +1534,35 @@ Array [
-
- - -
, -] +
+
+
`; exports[`renders ./components/select/demo/custom-dropdown-menu.tsx extend context correctly 1`] = ` @@ -2013,168 +2049,179 @@ exports[`renders ./components/select/demo/custom-tag-render.tsx extend context c exports[`renders ./components/select/demo/debug.tsx extend context correctly 1`] = `
- +
- - - - - 233 - -
-
-
-
+ + + + + 233 + +
+
+
+
- jack +
+ jack +
+
+ lucy +
- lucy -
-
-
-
-
-
+
+
- Jack +
+ Jack +
+
-
-
- Lucy +
+ Lucy +
+
-
-
- Disabled +
+ Disabled +
+
-
-
- yiminghe +
+ yiminghe +
+
-
-
- I am super super long! +
+ I am super super long! +
+
-
@@ -2182,237 +2229,242 @@ exports[`renders ./components/select/demo/debug.tsx extend context correctly 1`]
-
- - +
-
-
-
-
-
+
+
+
- jack +
+ jack +
+
+ lucy +
- lucy -
-
-
-
-
-
+
+
- Jack -
-
-
-
- Lucy -
-
+
+
+ Lucy +
+ - -
-
-
- Disabled
-
-
- yiminghe +
+ Disabled +
-
-
- I am super super long! +
+ yiminghe +
+
+
+
+ I am super super long! +
@@ -2423,19 +2475,29 @@ exports[`renders ./components/select/demo/debug.tsx extend context correctly 1`]
- - AntDesign - - +
+
+ +
`; @@ -2728,508 +2790,516 @@ exports[`renders ./components/select/demo/label-in-value.tsx extend context corr `; exports[`renders ./components/select/demo/multiple.tsx extend context correctly 1`] = ` -Array [ +
@@ -5995,655 +6104,22 @@ Array [
,
,
-
- - - - - a1 - -
-
-
-
-
-
- a10 -
-
- b11 -
-
-
-
-
-
-
-
- a10 -
-
-
-
- b11 -
-
-
-
- c12 -
-
-
-
- d13 -
-
-
-
- e14 -
-
-
-
- f15 -
-
-
-
- g16 -
-
-
-
- h17 -
-
-
-
- i18 -
-
-
-
- j19 -
-
-
-
- k20 -
-
-
-
- l21 -
-
-
-
- m22 -
-
-
-
- n23 -
-
-
-
- o24 -
-
-
-
- p25 -
-
-
-
- q26 -
-
-
-
- r27 -
-
-
-
- s28 -
-
-
-
- t29 -
-
-
-
- u30 -
-
-
-
- v31 -
-
-
-
- w32 -
-
-
-
- x33 -
-
-
-
- y34 -
-
-
-
- z35 -
-
-
-
-
-
-
-
-
- -
, -
, - +
+ +
-
-
-
-
+ class="ant-slider ant-slider-horizontal" + >
+ class="ant-slider-rail" + /> +
+
+
+
- -
-
-
-
- - + + - - - + + - -
-
- +
+
+ +
diff --git a/components/slider/__tests__/__snapshots__/demo.test.ts.snap b/components/slider/__tests__/__snapshots__/demo.test.ts.snap index d0a3a17177..1ec967743f 100644 --- a/components/slider/__tests__/__snapshots__/demo.test.ts.snap +++ b/components/slider/__tests__/__snapshots__/demo.test.ts.snap @@ -254,231 +254,243 @@ exports[`renders ./components/slider/demo/icon-slider.tsx correctly 1`] = ` `; exports[`renders ./components/slider/demo/input-number.tsx correctly 1`] = ` -
+
-
-
-
-
-
-
-
-
- +
+
+
- - - - - - - - - -
-
-
+
+
+
+ + + + + + + + + + +
+
+ +
+
+
-
-
-
-
-
-
-
-
- +
+
+
- - - - - - - - - -
-
-
+
+
+
+ + + + + + + + + + +
+
+ +
+
+
diff --git a/components/slider/demo/basic.md b/components/slider/demo/basic.md index 44ee5fd261..0b6200d0fc 100644 --- a/components/slider/demo/basic.md +++ b/components/slider/demo/basic.md @@ -5,9 +5,3 @@ ## en-US Basic slider. When `range` is `true`, display as dual thumb mode. When `disable` is `true`, the slider will not be interactable. - - diff --git a/components/slider/demo/input-number.tsx b/components/slider/demo/input-number.tsx index d4608b628c..348fc2dd65 100644 --- a/components/slider/demo/input-number.tsx +++ b/components/slider/demo/input-number.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; -import { Col, InputNumber, Row, Slider } from 'antd'; +import { Col, InputNumber, Row, Slider, Space } from 'antd'; -const IntegerStep = () => { +const IntegerStep: React.FC = () => { const [inputValue, setInputValue] = useState(1); const onChange = (newValue: number) => { @@ -31,14 +31,13 @@ const IntegerStep = () => { ); }; -const DecimalStep = () => { +const DecimalStep: React.FC = () => { const [inputValue, setInputValue] = useState(0); const onChange = (value: number) => { if (isNaN(value)) { return; } - setInputValue(value); }; @@ -68,10 +67,10 @@ const DecimalStep = () => { }; const App: React.FC = () => ( -
+ -
+ ); export default App; diff --git a/components/slider/demo/vertical.tsx b/components/slider/demo/vertical.tsx index 7843cda146..0799a28394 100644 --- a/components/slider/demo/vertical.tsx +++ b/components/slider/demo/vertical.tsx @@ -13,9 +13,7 @@ const marks: SliderMarks = { 26: '26°C', 37: '37°C', 100: { - style: { - color: '#f50', - }, + style: { color: '#f50' }, label: 100°C, }, }; diff --git a/components/switch/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/switch/__tests__/__snapshots__/demo-extend.test.ts.snap index bdd2e4d867..e27133747d 100644 --- a/components/switch/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/switch/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -24,38 +24,48 @@ exports[`renders ./components/switch/demo/basic.tsx extend context correctly 1`] `; exports[`renders ./components/switch/demo/disabled.tsx extend context correctly 1`] = ` -Array [ - , -
, - +
+
- - Toggle disabled - - , -] + +
+
`; exports[`renders ./components/switch/demo/loading.tsx extend context correctly 1`] = ` diff --git a/components/switch/__tests__/__snapshots__/demo.test.ts.snap b/components/switch/__tests__/__snapshots__/demo.test.ts.snap index fe0be028b2..67436d5006 100644 --- a/components/switch/__tests__/__snapshots__/demo.test.ts.snap +++ b/components/switch/__tests__/__snapshots__/demo.test.ts.snap @@ -24,38 +24,48 @@ exports[`renders ./components/switch/demo/basic.tsx correctly 1`] = ` `; exports[`renders ./components/switch/demo/disabled.tsx correctly 1`] = ` -Array [ - , -
, - +
+
- - Toggle disabled - - , -] + +
+
`; exports[`renders ./components/switch/demo/loading.tsx correctly 1`] = ` diff --git a/components/switch/demo/basic.md b/components/switch/demo/basic.md index 95c8b37a7a..c2120a5571 100644 --- a/components/switch/demo/basic.md +++ b/components/switch/demo/basic.md @@ -5,9 +5,3 @@ ## en-US The most basic usage. - - diff --git a/components/switch/demo/disabled.tsx b/components/switch/demo/disabled.tsx index 1f92b67a59..93db98e942 100644 --- a/components/switch/demo/disabled.tsx +++ b/components/switch/demo/disabled.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { Button, Switch } from 'antd'; +import { Button, Space, Switch } from 'antd'; const App: React.FC = () => { const [disabled, setDisabled] = useState(true); @@ -9,13 +9,12 @@ const App: React.FC = () => { }; return ( - <> + -
- +
); }; diff --git a/docs/react/introduce.en-US.md b/docs/react/introduce.en-US.md index e48c1253da..7e87404d26 100644 --- a/docs/react/introduce.en-US.md +++ b/docs/react/introduce.en-US.md @@ -83,6 +83,7 @@ We provide `antd.js` and `antd.min.js` `reset.css` under [dist](https://unpkg.co ## Usage ```jsx +import React from 'react'; import { DatePicker } from 'antd'; const App = () => { diff --git a/docs/react/introduce.zh-CN.md b/docs/react/introduce.zh-CN.md index 400c69f740..13632da76b 100644 --- a/docs/react/introduce.zh-CN.md +++ b/docs/react/introduce.zh-CN.md @@ -83,6 +83,7 @@ $ yarn add antd ## 示例 ```jsx +import React from 'react'; import { DatePicker } from 'antd'; const App = () => {