From d181aa685891df63121858f84ac283336af0d20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=89=AF?= Date: Tue, 29 Aug 2023 10:52:55 +0800 Subject: [PATCH] chore: radio mini demo --- .../src/pages/radio/component/basic.tsx | 27 ++++++ .../src/pages/radio/component/button.tsx | 39 ++++++++ .../src/pages/radio/component/group.tsx | 27 ++++++ .../src/pages/radio/component/list.tsx | 28 ++++++ packages/mini-demo/src/pages/radio/index.tsx | 96 +++---------------- packages/zarm/src/radio/demo/basic.mini.tsx | 8 +- packages/zarm/src/radio/demo/button.mini.tsx | 8 +- packages/zarm/src/radio/demo/group.mini.tsx | 8 +- packages/zarm/src/radio/demo/list.mini.tsx | 33 +++---- packages/zarm/src/radio/style/index.mini.ts | 3 +- 10 files changed, 160 insertions(+), 117 deletions(-) create mode 100644 packages/mini-demo/src/pages/radio/component/basic.tsx create mode 100644 packages/mini-demo/src/pages/radio/component/button.tsx create mode 100644 packages/mini-demo/src/pages/radio/component/group.tsx create mode 100644 packages/mini-demo/src/pages/radio/component/list.tsx diff --git a/packages/mini-demo/src/pages/radio/component/basic.tsx b/packages/mini-demo/src/pages/radio/component/basic.tsx new file mode 100644 index 000000000..8d7d0f900 --- /dev/null +++ b/packages/mini-demo/src/pages/radio/component/basic.tsx @@ -0,0 +1,27 @@ +import * as React from 'react'; +import { List, Panel, Radio } from 'zarm/mini'; + +const Demo = () => { + return ( + + + + 普通 + + + 默认选中 + + + 禁用 + + + + 选中且禁用 + + + + + ); +}; + +export default Demo; diff --git a/packages/mini-demo/src/pages/radio/component/button.tsx b/packages/mini-demo/src/pages/radio/component/button.tsx new file mode 100644 index 000000000..41fccbfc5 --- /dev/null +++ b/packages/mini-demo/src/pages/radio/component/button.tsx @@ -0,0 +1,39 @@ +import * as React from 'react'; +import { List, Panel, Radio } from 'zarm/mini'; + +const Demo = () => { + return ( + + + + 选项一 + 选项二 + 选项三 + + + + + 选项一 + 选项二 + 选项三 + + + + + 选项一 + 选项二 + 选项三 + + + + + 选项一 + 选项二 + 选项三 + + + + ); +}; + +export default Demo; diff --git a/packages/mini-demo/src/pages/radio/component/group.tsx b/packages/mini-demo/src/pages/radio/component/group.tsx new file mode 100644 index 000000000..78c0f2b32 --- /dev/null +++ b/packages/mini-demo/src/pages/radio/component/group.tsx @@ -0,0 +1,27 @@ +import * as React from 'react'; +import { List, Panel, Radio } from 'zarm/mini'; + +const Demo = () => { + const [value, setValue] = React.useState([]); + + const onChange = (val) => { + console.log('onChange', val); + setValue(val); + }; + + return ( + + + + + 选项一 + 选项二 + 选项三 + + + + + ); +}; + +export default Demo; diff --git a/packages/mini-demo/src/pages/radio/component/list.tsx b/packages/mini-demo/src/pages/radio/component/list.tsx new file mode 100644 index 000000000..4d6c30e9b --- /dev/null +++ b/packages/mini-demo/src/pages/radio/component/list.tsx @@ -0,0 +1,28 @@ +import * as React from 'react'; +import { List, Panel, Radio } from 'zarm/mini'; + +const Demo = () => { + return ( + <> + + + 选项一 + 选项二 + + 选项三(禁止选择) + + + + + + + 选项一 + 选项二 + + + + + ); +}; + +export default Demo; diff --git a/packages/mini-demo/src/pages/radio/index.tsx b/packages/mini-demo/src/pages/radio/index.tsx index 17adfe7be..c833f9816 100644 --- a/packages/mini-demo/src/pages/radio/index.tsx +++ b/packages/mini-demo/src/pages/radio/index.tsx @@ -1,91 +1,17 @@ -import { View } from '@tarojs/components'; import * as React from 'react'; -import { List, Radio } from 'zarm/mini'; +import Basic from './component/basic'; +import Button from './component/button'; +import Group from './component/group'; +import List from './component/list'; import './index.scss'; -const Demo = () => { - const [value, setValue] = React.useState([]); - - const onChange = (value) => { - console.log('onChange', value); - setValue(value); - }; - +export default () => { return ( - - 基本用法 - - - 普通 - - - 默认选中 - - - 禁用 - - - - 选中且禁用 - - - - 组合使用 - - - - 选项一 - 选项二 - 选项三 - - - - 列表样式 - - 选项一 - 选项二 - - 选项三(禁止选择) - - - 通栏样式 - - - 选项一 - 选项二 - - - 按钮样式 - - - 选项一 - 选项二 - 选项三 - - - - - 选项一 - 选项二 - 选项三 - - - - - 选项一 - 选项二 - 选项三 - - - - - 选项一 - 选项二 - 选项三 - - - + <> + + + +