From 4deeb8d4d1a98ffd14405cad19a8d80978ffc55c Mon Sep 17 00:00:00 2001 From: "Alex.huxiyang" <99181718+Alex-huxiyang@users.noreply.github.com> Date: Wed, 13 Mar 2024 17:36:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(divider):=20demo=E6=8B=86=E8=A7=A3=E4=B8=8E?= =?UTF-8?q?=E8=A7=84=E8=8C=83=20(#2013)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/divider/demo.taro.tsx | 76 ++++--------------- src/packages/divider/demo.tsx | 69 ++++------------- src/packages/divider/demos/h5/demo1.tsx | 11 +++ src/packages/divider/demos/h5/demo2.tsx | 11 +++ src/packages/divider/demos/h5/demo3.tsx | 16 ++++ src/packages/divider/demos/h5/demo4.tsx | 11 +++ src/packages/divider/demos/h5/demo5.tsx | 20 +++++ src/packages/divider/demos/h5/demo6.tsx | 21 ++++++ src/packages/divider/demos/taro/demo1.tsx | 11 +++ src/packages/divider/demos/taro/demo2.tsx | 11 +++ src/packages/divider/demos/taro/demo3.tsx | 16 ++++ src/packages/divider/demos/taro/demo4.tsx | 11 +++ src/packages/divider/demos/taro/demo5.tsx | 20 +++++ src/packages/divider/demos/taro/demo6.tsx | 21 ++++++ src/packages/divider/doc.en-US.md | 91 ++--------------------- src/packages/divider/doc.md | 91 ++--------------------- src/packages/divider/doc.taro.md | 91 ++--------------------- src/packages/divider/doc.zh-TW.md | 91 ++--------------------- 18 files changed, 231 insertions(+), 458 deletions(-) create mode 100644 src/packages/divider/demos/h5/demo1.tsx create mode 100644 src/packages/divider/demos/h5/demo2.tsx create mode 100644 src/packages/divider/demos/h5/demo3.tsx create mode 100644 src/packages/divider/demos/h5/demo4.tsx create mode 100644 src/packages/divider/demos/h5/demo5.tsx create mode 100644 src/packages/divider/demos/h5/demo6.tsx create mode 100644 src/packages/divider/demos/taro/demo1.tsx create mode 100644 src/packages/divider/demos/taro/demo2.tsx create mode 100644 src/packages/divider/demos/taro/demo3.tsx create mode 100644 src/packages/divider/demos/taro/demo4.tsx create mode 100644 src/packages/divider/demos/taro/demo5.tsx create mode 100644 src/packages/divider/demos/taro/demo6.tsx diff --git a/src/packages/divider/demo.taro.tsx b/src/packages/divider/demo.taro.tsx index 53d22554e0..431c07204b 100644 --- a/src/packages/divider/demo.taro.tsx +++ b/src/packages/divider/demo.taro.tsx @@ -1,21 +1,17 @@ import React from 'react' import Taro from '@tarojs/taro' -import { Divider, Cell } from '@/packages/nutui.react.taro' +import { Cell } from '@/packages/nutui.react.taro' import { useTranslate } from '@/sites/assets/locale/taro' import Header from '@/sites/components/header' +import Demo1 from './demos/taro/demo1' +import Demo2 from './demos/taro/demo2' +import Demo3 from './demos/taro/demo3' +import Demo4 from './demos/taro/demo4' +import Demo5 from './demos/taro/demo5' +import Demo6 from './demos/taro/demo6' -interface T { - basic: string - withText: string - contentPosition: string - dashed: string - customStyle: string - verticalDivider: string - text: string - link: string -} const DividerDemo = () => { - const [translated] = useTranslate({ + const [translated] = useTranslate({ 'zh-CN': { basic: '基础用法', withText: '展示文本', @@ -23,8 +19,6 @@ const DividerDemo = () => { dashed: '虚线', customStyle: '自定义样式', verticalDivider: '垂直分割线', - text: '文本', - link: '链接', }, 'en-US': { basic: 'Basic Usage', @@ -33,8 +27,6 @@ const DividerDemo = () => { dashed: 'Dashed', customStyle: 'Custom Style', verticalDivider: 'Vertical Divider', - text: 'Text', - link: 'Link', }, }) return ( @@ -43,65 +35,25 @@ const DividerDemo = () => {

{translated.basic}

- +

{translated.withText}

- {translated.text} +

{translated.contentPosition}

- - {translated.text} - - - {translated.text} - +

{translated.dashed}

- - {translated.text} - +

{translated.customStyle}

- - {translated.text} - +

{translated.verticalDivider}

-
- {translated.text} - - { - Taro.navigateTo({ url: '/pages/index/index' }) - }} - style={{ color: '#1989fa', display: 'inline-block' }} - > - {translated.link} - - - { - Taro.navigateTo({ url: '/pages/index/index' }) - }} - style={{ color: '#1989fa', display: 'inline-block' }} - > - {translated.link} - -
+
diff --git a/src/packages/divider/demo.tsx b/src/packages/divider/demo.tsx index b535a606b2..d3eaf752a6 100644 --- a/src/packages/divider/demo.tsx +++ b/src/packages/divider/demo.tsx @@ -1,20 +1,15 @@ import React from 'react' -import { Divider } from './divider' import { useTranslate } from '../../sites/assets/locale' import Cell from '@/packages/cell' +import Demo1 from './demos/h5/demo1' +import Demo2 from './demos/h5/demo2' +import Demo3 from './demos/h5/demo3' +import Demo4 from './demos/h5/demo4' +import Demo5 from './demos/h5/demo5' +import Demo6 from './demos/h5/demo6' -interface T { - basic: string - withText: string - contentPosition: string - dashed: string - customStyle: string - verticalDivider: string - text: string - link: string -} const DividerDemo = () => { - const [translated] = useTranslate({ + const [translated] = useTranslate({ 'zh-CN': { basic: '基础用法', withText: '展示文本', @@ -22,8 +17,6 @@ const DividerDemo = () => { dashed: '虚线', customStyle: '自定义样式', verticalDivider: '垂直分割线', - text: '文本', - link: '链接', }, 'en-US': { basic: 'Basic Usage', @@ -32,8 +25,6 @@ const DividerDemo = () => { dashed: 'Dashed', customStyle: 'Custom Style', verticalDivider: 'Vertical Divider', - text: 'Text', - link: 'Link', }, }) return ( @@ -41,59 +32,25 @@ const DividerDemo = () => {

{translated.basic}

- + -

{translated.withText}

- {translated.text} + -

{translated.contentPosition}

- - {translated.text} - - - {translated.text} - +

{translated.dashed}

- - {translated.text} - + -

{translated.customStyle}

- - {translated.text} - +

{translated.verticalDivider}

-
- {translated.text} - - - - {translated.link} - - - - {translated.link} - -
+
diff --git a/src/packages/divider/demos/h5/demo1.tsx b/src/packages/divider/demos/h5/demo1.tsx new file mode 100644 index 0000000000..0c5fcf3194 --- /dev/null +++ b/src/packages/divider/demos/h5/demo1.tsx @@ -0,0 +1,11 @@ +import React from 'react' +import { Divider } from '@nutui/nutui-react' + +const Demo1 = () => { + return ( + <> + + + ) +} +export default Demo1 diff --git a/src/packages/divider/demos/h5/demo2.tsx b/src/packages/divider/demos/h5/demo2.tsx new file mode 100644 index 0000000000..373d52ff44 --- /dev/null +++ b/src/packages/divider/demos/h5/demo2.tsx @@ -0,0 +1,11 @@ +import React from 'react' +import { Divider } from '@nutui/nutui-react' + +const Demo2 = () => { + return ( + <> + 文本 + + ) +} +export default Demo2 diff --git a/src/packages/divider/demos/h5/demo3.tsx b/src/packages/divider/demos/h5/demo3.tsx new file mode 100644 index 0000000000..8b45e83d67 --- /dev/null +++ b/src/packages/divider/demos/h5/demo3.tsx @@ -0,0 +1,16 @@ +import React from 'react' +import { Divider, Cell } from '@nutui/nutui-react' + +const Demo3 = () => { + return ( + <> + + 文本 + + + 文本 + + + ) +} +export default Demo3 diff --git a/src/packages/divider/demos/h5/demo4.tsx b/src/packages/divider/demos/h5/demo4.tsx new file mode 100644 index 0000000000..eb21f574d1 --- /dev/null +++ b/src/packages/divider/demos/h5/demo4.tsx @@ -0,0 +1,11 @@ +import React from 'react' +import { Divider } from '@nutui/nutui-react' + +const Demo4 = () => { + return ( + <> + 文本 + + ) +} +export default Demo4 diff --git a/src/packages/divider/demos/h5/demo5.tsx b/src/packages/divider/demos/h5/demo5.tsx new file mode 100644 index 0000000000..d6a5da72a8 --- /dev/null +++ b/src/packages/divider/demos/h5/demo5.tsx @@ -0,0 +1,20 @@ +import React from 'react' +import { Divider } from '@nutui/nutui-react' + +const Demo5 = () => { + return ( + <> + + 文本 + + + ) +} +export default Demo5 diff --git a/src/packages/divider/demos/h5/demo6.tsx b/src/packages/divider/demos/h5/demo6.tsx new file mode 100644 index 0000000000..ca5d62bda7 --- /dev/null +++ b/src/packages/divider/demos/h5/demo6.tsx @@ -0,0 +1,21 @@ +import React from 'react' +import { Divider } from '@nutui/nutui-react' + +const Demo6 = () => { + return ( + <> +
+ 文本 + + + 链接 + + + + 链接 + +
+ + ) +} +export default Demo6 diff --git a/src/packages/divider/demos/taro/demo1.tsx b/src/packages/divider/demos/taro/demo1.tsx new file mode 100644 index 0000000000..1a11faf3d2 --- /dev/null +++ b/src/packages/divider/demos/taro/demo1.tsx @@ -0,0 +1,11 @@ +import React from 'react' +import { Divider } from '@nutui/nutui-react-taro' + +const Demo1 = () => { + return ( + <> + + + ) +} +export default Demo1 diff --git a/src/packages/divider/demos/taro/demo2.tsx b/src/packages/divider/demos/taro/demo2.tsx new file mode 100644 index 0000000000..bdf98f1178 --- /dev/null +++ b/src/packages/divider/demos/taro/demo2.tsx @@ -0,0 +1,11 @@ +import React from 'react' +import { Divider } from '@nutui/nutui-react-taro' + +const Demo2 = () => { + return ( + <> + 文本 + + ) +} +export default Demo2 diff --git a/src/packages/divider/demos/taro/demo3.tsx b/src/packages/divider/demos/taro/demo3.tsx new file mode 100644 index 0000000000..be567fcece --- /dev/null +++ b/src/packages/divider/demos/taro/demo3.tsx @@ -0,0 +1,16 @@ +import React from 'react' +import { Divider, Cell } from '@nutui/nutui-react-taro' + +const Demo3 = () => { + return ( + <> + + 文本 + + + 文本 + + + ) +} +export default Demo3 diff --git a/src/packages/divider/demos/taro/demo4.tsx b/src/packages/divider/demos/taro/demo4.tsx new file mode 100644 index 0000000000..24bc293180 --- /dev/null +++ b/src/packages/divider/demos/taro/demo4.tsx @@ -0,0 +1,11 @@ +import React from 'react' +import { Divider } from '@nutui/nutui-react-taro' + +const Demo4 = () => { + return ( + <> + 文本 + + ) +} +export default Demo4 diff --git a/src/packages/divider/demos/taro/demo5.tsx b/src/packages/divider/demos/taro/demo5.tsx new file mode 100644 index 0000000000..440d0806e3 --- /dev/null +++ b/src/packages/divider/demos/taro/demo5.tsx @@ -0,0 +1,20 @@ +import React from 'react' +import { Divider } from '@nutui/nutui-react-taro' + +const Demo5 = () => { + return ( + <> + + 文本 + + + ) +} +export default Demo5 diff --git a/src/packages/divider/demos/taro/demo6.tsx b/src/packages/divider/demos/taro/demo6.tsx new file mode 100644 index 0000000000..a56f734ebc --- /dev/null +++ b/src/packages/divider/demos/taro/demo6.tsx @@ -0,0 +1,21 @@ +import React from 'react' +import { Divider } from '@nutui/nutui-react-taro' + +const Demo6 = () => { + return ( + <> +
+ 文本 + + + 链接 + + + + 链接 + +
+ + ) +} +export default Demo6 diff --git a/src/packages/divider/doc.en-US.md b/src/packages/divider/doc.en-US.md index bafa3bec9b..035623373d 100644 --- a/src/packages/divider/doc.en-US.md +++ b/src/packages/divider/doc.en-US.md @@ -18,19 +18,7 @@ Default render one horizontal divider line. :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - - - ); -}; -export default App; -``` + ::: @@ -40,19 +28,7 @@ Insert text into divider with default slot. :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - Text - - ); -}; -export default App; -``` + ::: @@ -62,20 +38,7 @@ Set Content Position with `contentPosition` attribute. :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - Text - Text - - ); -}; -export default App; -``` + ::: @@ -83,19 +46,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - Text - - ); -}; -export default App; -``` + ::: @@ -105,19 +56,7 @@ User can custom divider style with `style` attribute. :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - Text - - ); -}; -export default App; -``` + ::: @@ -125,25 +64,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> -
- 文本 - - Link - - Link -
- - ); -}; -export default App; -``` + ::: diff --git a/src/packages/divider/doc.md b/src/packages/divider/doc.md index 2db3cb765d..33779041b1 100644 --- a/src/packages/divider/doc.md +++ b/src/packages/divider/doc.md @@ -18,19 +18,7 @@ import { Divider } from '@nutui/nutui-react'; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - - - ); -}; -export default App; -``` + ::: @@ -40,19 +28,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - 文本 - - ); -}; -export default App; -``` + ::: @@ -62,20 +38,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - 文本 - 文本 - - ); -}; -export default App; -``` + ::: @@ -83,19 +46,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - 文本 - - ); -}; -export default App; -``` + ::: @@ -105,19 +56,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - 文本 - - ); -}; -export default App; -``` + ::: @@ -125,25 +64,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> -
- 文本 - - 链接 - - 链接 -
- - ); -}; -export default App; -``` + ::: diff --git a/src/packages/divider/doc.taro.md b/src/packages/divider/doc.taro.md index 5bf8bc6aa7..1ea44688c1 100644 --- a/src/packages/divider/doc.taro.md +++ b/src/packages/divider/doc.taro.md @@ -18,19 +18,7 @@ import { Divider } from '@nutui/nutui-react-taro'; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react-taro'; - -const App = () => { - return ( - <> - - - ); -}; -export default App; -``` + ::: @@ -40,19 +28,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react-taro'; - -const App = () => { - return ( - <> - 文本 - - ); -}; -export default App; -``` + ::: @@ -62,20 +38,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react-taro'; - -const App = () => { - return ( - <> - 文本 - 文本 - - ); -}; -export default App; -``` + ::: @@ -83,19 +46,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react-taro'; - -const App = () => { - return ( - <> - 文本 - - ); -}; -export default App; -``` + ::: @@ -105,19 +56,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react-taro'; - -const App = () => { - return ( - <> - 文本 - - ); -}; -export default App; -``` + ::: @@ -125,25 +64,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react-taro'; - -const App = () => { - return ( - <> -
- 文本 - - 链接 - - 链接 -
- - ); -}; -export default App; -``` + ::: diff --git a/src/packages/divider/doc.zh-TW.md b/src/packages/divider/doc.zh-TW.md index 07cddb0890..06e7266bfa 100644 --- a/src/packages/divider/doc.zh-TW.md +++ b/src/packages/divider/doc.zh-TW.md @@ -18,19 +18,7 @@ import { Divider } from '@nutui/nutui-react'; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - - - ); -}; -export default App; -``` + ::: @@ -40,19 +28,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - 文本 - - ); -}; -export default App; -``` + ::: @@ -62,20 +38,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - 文本 - 文本 - - ); -}; -export default App; -``` + ::: @@ -83,19 +46,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - 文本 - - ); -}; -export default App; -``` + ::: @@ -105,19 +56,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> - 文本 - - ); -}; -export default App; -``` + ::: @@ -125,25 +64,7 @@ export default App; :::demo -```tsx -import React from "react"; -import { Divider } from '@nutui/nutui-react'; - -const App = () => { - return ( - <> -
- 文本 - - 鏈接 - - 鏈接 -
- - ); -}; -export default App; -``` + :::