From 84d97c48085a807fc2b13b1613ede88bc150e4e2 Mon Sep 17 00:00:00 2001 From: oasis-cloud Date: Wed, 30 Nov 2022 15:02:45 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20popover=20demo=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=99=BD=E8=89=B2=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/popover/demo.scss | 8 ++ src/packages/popover/demo.taro.tsx | 216 ++++++++++++++-------------- src/packages/popover/demo.tsx | 223 +++++++++++++++-------------- 3 files changed, 236 insertions(+), 211 deletions(-) diff --git a/src/packages/popover/demo.scss b/src/packages/popover/demo.scss index 2b6b720..afd76af 100644 --- a/src/packages/popover/demo.scss +++ b/src/packages/popover/demo.scss @@ -24,3 +24,11 @@ .customContent .popover-content { width: 200px; } + +.demo-cell-popove { + flex-wrap: wrap; +} + +.nut-popover { + height: 38px; +} diff --git a/src/packages/popover/demo.taro.tsx b/src/packages/popover/demo.taro.tsx index 32c5f2f..f7ef2e2 100644 --- a/src/packages/popover/demo.taro.tsx +++ b/src/packages/popover/demo.taro.tsx @@ -1,5 +1,5 @@ import React, { useRef, useState } from 'react' -import { Button, Icon, Popover } from '@/packages/nutui.react.taro' +import { Button, Icon, Popover, Cell } from '@/packages/nutui.react.taro' import '@/packages/popover/demo.scss' interface List { @@ -130,92 +130,98 @@ const BadgeDemo = () => { <>

基础用法

- { - lightTheme ? setLightTheme(false) : setLightTheme(true) - }} - list={itemList} - style={{ marginRight: '30px' }} - > - - - { - darkTheme ? setDarkTheme(false) : setDarkTheme(true) - }} - list={itemList} - > - - - + + { + lightTheme ? setLightTheme(false) : setLightTheme(true) + }} + list={itemList} + style={{ marginRight: '30px' }} + > + + + { + darkTheme ? setDarkTheme(false) : setDarkTheme(true) + }} + list={itemList} + > + + +

选项配置

- { - showIcon ? setShowIcon(false) : setShowIcon(true) - }} - list={iconItemList} - style={{ marginRight: '30px' }} - > - - - { - disableAction ? setDisableAction(false) : setDisableAction(true) - }} - list={itemListDisabled} - onChoose={chooseHandle} - > - - - + + { + showIcon ? setShowIcon(false) : setShowIcon(true) + }} + list={iconItemList} + style={{ marginRight: '30px' }} + > + + + { + disableAction ? setDisableAction(false) : setDisableAction(true) + }} + list={itemListDisabled} + onChoose={chooseHandle} + > + + +

自定义内容

- { - customized ? setCustomized(false) : setCustomized(true) - }} - location="bottom-start" - className="customContent" - > - - {customized ? ( -
- {selfContent.map((item: any) => { - return ( -
- -
- {item.desc} + + { + customized ? setCustomized(false) : setCustomized(true) + }} + location="bottom-start" + className="customContent" + > + + {customized ? ( +
+ {selfContent.map((item: any) => { + return ( +
+ +
+ {item.desc} +
-
- ) - })} -
- ) : ( - '' - )} - - + ) + })} +
+ ) : ( + '' + )} + +

位置自定义

{
-
- {customLocation.current.map((location, i) => { - const k = Object.keys(location)[0] as any - const v = Object.values(location)[0] - return ( - - ) - })} -
+ +
+ {customLocation.current.map((location, i) => { + const k = Object.keys(location)[0] as any + const v = Object.values(location)[0] + return ( + + ) + })} +
+
) diff --git a/src/packages/popover/demo.tsx b/src/packages/popover/demo.tsx index 03a089c..4abe10c 100644 --- a/src/packages/popover/demo.tsx +++ b/src/packages/popover/demo.tsx @@ -3,6 +3,7 @@ import { useTranslate } from '../../sites/assets/locale' import { Popover } from './popover' import Button from '@/packages/button' import Icon from '@/packages/icon' +import Cell from '@/packages/cell' interface T { [props: string]: string @@ -169,24 +170,24 @@ const BadgeDemo = () => { flex-wrap: wrap; justify-content: space-around; } - + .brickBox { display: flex; justify-content: center; margin: 80px 0; } - + .brick { width: 60px; height: 60px; background: #1989fa; border-radius: 10px; } - + .popover-content { width: 100px; } - + .customContent .popover-content{ width: 200px; } @@ -197,92 +198,99 @@ const BadgeDemo = () => {

{translated.title}

- { - lightTheme ? setLightTheme(false) : setLightTheme(true) - }} - list={itemList} - style={{ marginRight: '30px' }} - > - - - { - darkTheme ? setDarkTheme(false) : setDarkTheme(true) - }} - list={itemList} - > - - + + { + lightTheme ? setLightTheme(false) : setLightTheme(true) + }} + list={itemList} + style={{ marginRight: '30px' }} + > + + + { + darkTheme ? setDarkTheme(false) : setDarkTheme(true) + }} + list={itemList} + > + + +

{translated.title1}

- { - showIcon ? setShowIcon(false) : setShowIcon(true) - }} - list={iconItemList} - style={{ marginRight: '30px' }} - > - - - { - disableAction ? setDisableAction(false) : setDisableAction(true) - }} - list={itemListDisabled} - onChoose={chooseHandle} - > - - - + + { + showIcon ? setShowIcon(false) : setShowIcon(true) + }} + list={iconItemList} + style={{ marginRight: '30px' }} + > + + + { + disableAction ? setDisableAction(false) : setDisableAction(true) + }} + list={itemListDisabled} + onChoose={chooseHandle} + > + + +

{translated.content}

- { - customized ? setCustomized(false) : setCustomized(true) - }} - location="bottom-start" - className="customContent" - > - - {customized ? ( -
- {selfContent.map((item: any) => { - return ( -
- -
- {item.desc} + + { + customized ? setCustomized(false) : setCustomized(true) + }} + location="bottom-start" + className="customContent" + > + + {customized ? ( +
+ {selfContent.map((item: any) => { + return ( +
+ +
+ {item.desc} +
-
- ) - })} -
- ) : ( - '' - )} - - + ) + })} +
+ ) : ( + '' + )} + +

{translated.title3}

{ >
- -
- {customLocation.current.map((location, i) => { - const k = Object.keys(location)[0] as any - const v = Object.values(location)[0] - return ( - - ) - })} -
+ +
+ {customLocation.current.map((location, i) => { + const k = Object.keys(location)[0] as any + const v = Object.values(location)[0] + return ( + + ) + })} +
+
) -- GitLab