From a345526f00c97207d3e62abfc0740c372fa2b2aa Mon Sep 17 00:00:00 2001 From: oasis Date: Fri, 8 Nov 2024 11:43:10 +0800 Subject: [PATCH 1/3] feat(tag): update icon --- src/packages/tag/demos/taro/demo2.tsx | 6 ++-- src/packages/tag/tag.taro.tsx | 43 ++++++++++++++------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/packages/tag/demos/taro/demo2.tsx b/src/packages/tag/demos/taro/demo2.tsx index 09ba99c4a1..71e6a06a1c 100644 --- a/src/packages/tag/demos/taro/demo2.tsx +++ b/src/packages/tag/demos/taro/demo2.tsx @@ -1,5 +1,5 @@ import React from 'react' -// import { Failure } from '@nutui/icons-react-taro' +import { Failure } from '@nutui/icons-react-taro' import { Cell, Tag } from '@nutui/nutui-react-taro' import Taro from '@tarojs/taro' @@ -41,9 +41,7 @@ const Demo2 = () => { extra={ } + closeIcon={} onClose={() => Taro.showToast({ title: 'Tag closed' })} type="primary" > diff --git a/src/packages/tag/tag.taro.tsx b/src/packages/tag/tag.taro.tsx index b9ffcbe3d5..4febc5b1a2 100644 --- a/src/packages/tag/tag.taro.tsx +++ b/src/packages/tag/tag.taro.tsx @@ -1,12 +1,12 @@ +import type { MouseEvent } from 'react' import React, { CSSProperties, FunctionComponent, - useState, ReactNode, + useState, } from 'react' -import type { MouseEvent } from 'react' -import { View, ITouchEvent, Text } from '@tarojs/components' -// import { Close } from '@nutui/icons-react-taro' +import { ITouchEvent, View, Text } from '@tarojs/components' +import { Close } from '@nutui/icons-react-taro' import classNames from 'classnames' import { BasicComponent, ComponentDefaults } from '@/utils/typings' @@ -132,23 +132,24 @@ export const Tag: FunctionComponent> = (props) => { {closeIcon} ) : ( - // TODO: icon 适配 - // { - // setVisible(false) - // onClose && onClose(e) - // }} - // /> - { - setVisible(false) - onClose && onClose(e) - }} - className={`${classPrefix}-custom-icon`} - > - X - + <> + { + setVisible(false) + onClose && onClose(e) + }} + /> + { + setVisible(false) + onClose && onClose(e) + }} + className={`${classPrefix}-custom-icon`} + > + X + + )} ) From aa49d041277b312446d2dafadf8aeb1f6ded5da8 Mon Sep 17 00:00:00 2001 From: oasis Date: Fri, 8 Nov 2024 16:48:24 +0800 Subject: [PATCH 2/3] feat(tag): update icon --- src/packages/tag/tag.taro.tsx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/packages/tag/tag.taro.tsx b/src/packages/tag/tag.taro.tsx index 4febc5b1a2..86c28c3bfe 100644 --- a/src/packages/tag/tag.taro.tsx +++ b/src/packages/tag/tag.taro.tsx @@ -5,7 +5,7 @@ import React, { ReactNode, useState, } from 'react' -import { ITouchEvent, View, Text } from '@tarojs/components' +import { ITouchEvent, View } from '@tarojs/components' import { Close } from '@nutui/icons-react-taro' import classNames from 'classnames' @@ -140,15 +140,6 @@ export const Tag: FunctionComponent> = (props) => { onClose && onClose(e) }} /> - { - setVisible(false) - onClose && onClose(e) - }} - className={`${classPrefix}-custom-icon`} - > - X - )} From ddb51a9c3933bf31618007e05884a02ddec2b189 Mon Sep 17 00:00:00 2001 From: oasis Date: Fri, 8 Nov 2024 16:50:27 +0800 Subject: [PATCH 3/3] feat(tag): update icon --- src/packages/tag/tag.taro.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/packages/tag/tag.taro.tsx b/src/packages/tag/tag.taro.tsx index 86c28c3bfe..e82c3043bd 100644 --- a/src/packages/tag/tag.taro.tsx +++ b/src/packages/tag/tag.taro.tsx @@ -132,15 +132,13 @@ export const Tag: FunctionComponent> = (props) => { {closeIcon} ) : ( - <> - { - setVisible(false) - onClose && onClose(e) - }} - /> - + { + setVisible(false) + onClose && onClose(e) + }} + /> )} )