From 5625febb270199cf1527e8714fc3bfecc563f04b Mon Sep 17 00:00:00 2001 From: oasis Date: Thu, 10 Apr 2025 14:46:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(checkbox):=20=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E5=88=87=E6=8D=A2=E9=80=89=E4=B8=AD=E6=80=81?= =?UTF-8?q?=EF=BC=8C=E5=B8=83=E5=B1=80=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/checkbox/checkbox.scss | 7 ++++- src/packages/checkbox/checkbox.taro.tsx | 36 ++++++++++++++++++------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/packages/checkbox/checkbox.scss b/src/packages/checkbox/checkbox.scss index ebcb5b6b6d..4d63c4b0e6 100644 --- a/src/packages/checkbox/checkbox.scss +++ b/src/packages/checkbox/checkbox.scss @@ -10,12 +10,17 @@ flex-shrink: 0; } - &-icon-wrap { + &-icon-wrap-shadow { font-size: 0px; line-height: 0px; border-radius: 50%; box-shadow: 0px 2px 4px 0px rgba(255, 15, 35, 0.2); } + &-icon-wrap { + font-size: 0px; + line-height: 0px; + border-radius: 50%; + } &-icon-checked { color: $color-primary; diff --git a/src/packages/checkbox/checkbox.taro.tsx b/src/packages/checkbox/checkbox.taro.tsx index 3bc4464f7f..2216c80b84 100644 --- a/src/packages/checkbox/checkbox.taro.tsx +++ b/src/packages/checkbox/checkbox.taro.tsx @@ -1,7 +1,7 @@ import React, { FC, useContext, useEffect, useState } from 'react' import { CheckDisabled, Checked, CheckNormal } from '@nutui/icons-react-taro' import classNames from 'classnames' -import { CheckboxProps as TCheckboxProps, View } from '@tarojs/components' +import { CheckboxProps as TCheckboxProps, Text, View } from '@tarojs/components' import { ComponentDefaults } from '@/utils/typings' import Context from '../checkboxgroup/context' import { usePropsValue } from '@/hooks/use-props-value' @@ -79,31 +79,47 @@ export const Checkbox: FC< const renderIcon = () => { if (innerDisabled) { if (innerIndeterminate) { - return + return ( + + + + ) } if (innerChecked) { - return + return ( + + + + ) } - return + return ( + + + + ) } if (!innerChecked) { return React.isValidElement(icon) ? ( icon ) : ( - + + + ) } if (innerIndeterminate) { return React.isValidElement(indeterminateIcon) ? ( indeterminateIcon ) : ( - + + + ) } return React.isValidElement(activeIcon) ? ( activeIcon ) : ( - + ) @@ -129,13 +145,13 @@ export const Checkbox: FC< } const renderLabel = () => { return ( - {children || label} - + ) } @@ -178,7 +194,7 @@ export const Checkbox: FC< const renderCheckboxItem = () => { if (ctx?.list) { - return <>{renderListItem()} + return renderListItem() } if (shape === 'button') { return renderButton() From 3e973c7017590df8542fcf7695bece06ba3f3e3d Mon Sep 17 00:00:00 2001 From: oasis Date: Fri, 11 Apr 2025 17:08:24 +0800 Subject: [PATCH 2/3] fix: h5 --- src/packages/checkbox/checkbox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packages/checkbox/checkbox.tsx b/src/packages/checkbox/checkbox.tsx index d80018cbcb..d931828e2c 100644 --- a/src/packages/checkbox/checkbox.tsx +++ b/src/packages/checkbox/checkbox.tsx @@ -108,7 +108,7 @@ export const Checkbox: FunctionComponent< return React.isValidElement(activeIcon) ? ( activeIcon ) : ( -
+
) From c968861ba50f2fbcc6a6b6ff656321faf41328ae Mon Sep 17 00:00:00 2001 From: oasis Date: Fri, 11 Apr 2025 17:25:52 +0800 Subject: [PATCH 3/3] fix: build --- .../checkbox/__test__/__snapshots__/checkbox.spec.tsx.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packages/checkbox/__test__/__snapshots__/checkbox.spec.tsx.snap b/src/packages/checkbox/__test__/__snapshots__/checkbox.spec.tsx.snap index b6a4fe4c13..a1626f034c 100644 --- a/src/packages/checkbox/__test__/__snapshots__/checkbox.spec.tsx.snap +++ b/src/packages/checkbox/__test__/__snapshots__/checkbox.spec.tsx.snap @@ -6,7 +6,7 @@ exports[`should match snapshot 1`] = ` class="nut-checkbox nut-checkbox-reverse" >