From 8f7f98b9fe3c4bb5936977a4d8137e7ba1716b1a Mon Sep 17 00:00:00 2001 From: oasis Date: Sat, 9 Nov 2024 23:08:30 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"fix(inputnumber):=20icon=20=E9=80=82?= =?UTF-8?q?=E9=85=8D=20&&=20=E4=BF=AE=E6=94=B9icon=E5=AE=BD=E5=BA=A6?= =?UTF-8?q?=E5=92=8C=E8=AE=BE=E5=AE=9A=E7=9A=84--nut-icon-width=E4=B8=80?= =?UTF-8?q?=E8=87=B4=20(#2707)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 93383539b973b5afdd167eb362dfeff138864d2e. --- src/packages/inputnumber/doc.en-US.md | 2 +- src/packages/inputnumber/doc.md | 2 +- src/packages/inputnumber/doc.taro.md | 2 +- src/packages/inputnumber/doc.zh-TW.md | 2 +- .../inputnumber/inputnumber.harmony.css | 4 +- src/packages/inputnumber/inputnumber.taro.tsx | 69 ++++++++++++++----- src/styles/variables.scss | 2 +- 7 files changed, 58 insertions(+), 25 deletions(-) diff --git a/src/packages/inputnumber/doc.en-US.md b/src/packages/inputnumber/doc.en-US.md index 5b51a9bb4e..beb3542914 100644 --- a/src/packages/inputnumber/doc.en-US.md +++ b/src/packages/inputnumber/doc.en-US.md @@ -147,7 +147,7 @@ The component provides the following CSS variables, which can be used to customi | \--nutui-inputnumber-input-border | The border value of the input in the number input box | `0` | | \--nutui-inputnumber-input-border-radius | The rounded corners of the input in the number input box | `6px` | | \--nutui-inputnumber-input-margin | The rounded corners of the input in the number input box | `0` | -| \--nutui-inputnumber-button-width | The width of the left and right buttons of the number input box | `16px` | +| \--nutui-inputnumber-button-width | The width of the left and right buttons of the number input box | `14px` | | \--nutui-inputnumber-button-height | The height of the left and right buttons of the number input box | `16px` | | \--nutui-inputnumber-button-border-radius | The rounded corners of the left and right buttons of the number input box | `30px` | | \--nutui-inputnumber-button-background-color | The background color of the left and right buttons of the number input box | `transparent` | diff --git a/src/packages/inputnumber/doc.md b/src/packages/inputnumber/doc.md index 0586586475..d2afd0b4d1 100644 --- a/src/packages/inputnumber/doc.md +++ b/src/packages/inputnumber/doc.md @@ -147,7 +147,7 @@ import { InputNumber } from '@nutui/nutui-react' | \--nutui-inputnumber-input-border | 数字输入框中input的border值 | `0` | | \--nutui-inputnumber-input-border-radius | 数字输入框中input的圆角 | `6px` | | \--nutui-inputnumber-input-margin | 数字输入框中input的margin值 | `0` | -| \--nutui-inputnumber-button-width | 数字输入框左右按钮的宽度 | `16px` | +| \--nutui-inputnumber-button-width | 数字输入框左右按钮的宽度 | `14px` | | \--nutui-inputnumber-button-height | 数字输入框左右按钮的高度 | `16px` | | \--nutui-inputnumber-button-border-radius | 数字输入框左右按钮的圆角 | `30px` | | \--nutui-inputnumber-button-background-color | 数字输入框左右按钮的背景色 | `transparent` | diff --git a/src/packages/inputnumber/doc.taro.md b/src/packages/inputnumber/doc.taro.md index d834b22431..fb9a619b1c 100644 --- a/src/packages/inputnumber/doc.taro.md +++ b/src/packages/inputnumber/doc.taro.md @@ -139,7 +139,7 @@ import { InputNumber } from '@nutui/nutui-react-taro' | \--nutui-inputnumber-input-border | 数字输入框中input的border值 | `0` | | \--nutui-inputnumber-input-border-radius | 数字输入框中input的圆角 | `6px` | | \--nutui-inputnumber-input-margin | 数字输入框中input的margin值 | `0` | -| \--nutui-inputnumber-button-width | 数字输入框左右按钮的宽度 | `16px` | +| \--nutui-inputnumber-button-width | 数字输入框左右按钮的宽度 | `14px` | | \--nutui-inputnumber-button-height | 数字输入框左右按钮的高度 | `16px` | | \--nutui-inputnumber-button-border-radius | 数字输入框左右按钮的圆角 | `30px` | | \--nutui-inputnumber-button-background-color | 数字输入框左右按钮的背景色 | `transparent` | diff --git a/src/packages/inputnumber/doc.zh-TW.md b/src/packages/inputnumber/doc.zh-TW.md index 7db92e45e6..5a1cb78e4c 100644 --- a/src/packages/inputnumber/doc.zh-TW.md +++ b/src/packages/inputnumber/doc.zh-TW.md @@ -138,7 +138,7 @@ import { InputNumber } from '@nutui/nutui-react' | \--nutui-inputnumber-input-border | 數字輸入框中input的border值 | `0` | | \--nutui-inputnumber-input-border-radius | 數字輸入框中input的圓角 | `6px` | | \--nutui-inputnumber-input-margin | 數字輸入框中input的margin值 | `0` | -| \--nutui-inputnumber-button-width | 數字輸入框左右按鈕的寬度 | `16px` | +| \--nutui-inputnumber-button-width | 數字輸入框左右按鈕的寬度 | `14px` | | \--nutui-inputnumber-button-height | 數字輸入框左右按鈕的高度 | `16px` | | \--nutui-inputnumber-button-border-radius | 數字輸入框左右按鈕的圓角 | `30px` | | \--nutui-inputnumber-button-background-color | 數字輸入框左右按鈕的背景色 | `transparent` | diff --git a/src/packages/inputnumber/inputnumber.harmony.css b/src/packages/inputnumber/inputnumber.harmony.css index 24d0020e88..79800288af 100644 --- a/src/packages/inputnumber/inputnumber.harmony.css +++ b/src/packages/inputnumber/inputnumber.harmony.css @@ -7,7 +7,7 @@ display: flex; justify-content: center; align-items: center; - width: 16px; + width: 14px; height: 24px; background-color: transparent; border-radius: 16px; @@ -16,7 +16,7 @@ display: flex; justify-content: center; align-items: center; - width: 16px; + width: 14px; height: 24px; background-color: transparent; border-radius: 16px; diff --git a/src/packages/inputnumber/inputnumber.taro.tsx b/src/packages/inputnumber/inputnumber.taro.tsx index 282d26edcb..0e1bb46d87 100644 --- a/src/packages/inputnumber/inputnumber.taro.tsx +++ b/src/packages/inputnumber/inputnumber.taro.tsx @@ -11,11 +11,12 @@ import { Input as TaroInput, InputProps, View, + Text, } from '@tarojs/components' import { Minus, Plus } from '@nutui/icons-react-taro' import { usePropsValue } from '@/utils/use-props-value' import { BasicComponent, ComponentDefaults } from '@/utils/typings' -import { harmonyAndRn } from '@/utils/platform-taro' +import { harmony, harmonyAndRn, rn } from '@/utils/platform-taro' export interface InputNumberProps extends BasicComponent { value: number | string @@ -90,6 +91,8 @@ export const InputNumber: FunctionComponent< ...props, } const isRnAndHarmony = harmonyAndRn() + const isRn = rn() + const isHarmony = harmony() const classes = classNames(classPrefix, className) const [focused, setFocused] = useState(false) const inputRef = useRef(null) @@ -250,16 +253,31 @@ export const InputNumber: FunctionComponent< return ( - + {isRnAndHarmony ? ( + + - + + ) : ( + + )} - {isRnAndHarmony ? ( + {isRn ? ( - + {isRnAndHarmony ? ( + + + + + ) : ( + + )} ) diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 27e275a4ee..d7ff06d44b 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -629,7 +629,7 @@ $inputnumber-input-border-radius: var( 6px ) !default; $inputnumber-input-margin: var(--nutui-inputnumber-input-margin, 0) !default; -$inputnumber-button-width: var(--nutui-inputnumber-button-width, 16px) !default; +$inputnumber-button-width: var(--nutui-inputnumber-button-width, 14px) !default; $inputnumber-button-height: var( --nutui-inputnumber-button-height, 24px