Skip to content

Commit

Permalink
feat(input): update icon (#2711)
Browse files Browse the repository at this point in the history
  • Loading branch information
oasis-cloud authored Nov 8, 2024
1 parent 76ca5fc commit d53f051
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
5 changes: 1 addition & 4 deletions src/packages/input/demos/taro/demo13.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react'
import { Button, Input } from '@nutui/nutui-react-taro'
import { Tips } from '@nutui/icons-react-taro'
import { Text, View } from '@tarojs/components'
import { harmonyAndRn } from '@/utils/platform-taro'
import pxTransform from '@/utils/px-transform'

const Demo13 = () => {
Expand All @@ -17,9 +16,7 @@ const Demo13 = () => {
backgroundColor: '#ffffff',
}}
>
{!harmonyAndRn() ? (
<Tips style={{ marginLeft: pxTransform(10) }} />
) : null}
<Tips style={{ marginLeft: pxTransform(10) }} />
<Input
placeholder="请输入短信验证码"
placeholderTextColor="#757575"
Expand Down
3 changes: 1 addition & 2 deletions src/packages/input/demos/taro/demo6.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import { Input } from '@nutui/nutui-react-taro'
import { Close } from '@nutui/icons-react-taro'
import { harmonyAndRn } from '@/utils/platform-taro'

const Demo6 = () => {
return (
Expand All @@ -13,7 +12,7 @@ const Demo6 = () => {
/>
<Input
clearable
clearIcon={!harmonyAndRn() ? <Close /> : null}
clearIcon={<Close />}
placeholder="显示清除图标"
placeholderTextColor="#757575"
/>
Expand Down
9 changes: 3 additions & 6 deletions src/packages/input/demos/taro/demo9.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useState } from 'react'
import { Input } from '@nutui/nutui-react-taro'
import { View } from '@tarojs/components'
import { Eye, Marshalling } from '@nutui/icons-react-taro'
import { harmonyAndRn } from '@/utils/platform-taro'
import pxTransform from '@/utils/px-transform'

const Demo9 = () => {
Expand Down Expand Up @@ -35,12 +34,10 @@ const Demo9 = () => {
>
{/* eslint-disable-next-line no-nested-ternary */}
{inputType === 'text' ? (
!harmonyAndRn() ? (
<Eye color="var(--nutui-gray-7)" />
) : null
) : !harmonyAndRn() ? (
<Eye color="var(--nutui-gray-7)" />
) : (
<Marshalling color="var(--nutui-gray-7)" />
) : null}
)}
</View>
</View>
</>
Expand Down
4 changes: 4 additions & 0 deletions src/packages/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@
-webkit-text-fill-color: $input-disabled-color;
}
}

.nut-input-clear {
flex: 0;
}
9 changes: 2 additions & 7 deletions src/packages/input/input.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { formatNumber } from './utils'
import { useConfig, useRtl } from '@/packages/configprovider/index.taro'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import { usePropsValue } from '@/utils/use-props-value'
import { harmonyAndRn } from '@/utils/platform-taro'

export type InputAlign = 'left' | 'center' | 'right'
export type InputFormatTrigger = 'onChange' | 'onBlur'
Expand Down Expand Up @@ -241,8 +240,7 @@ export const Input = forwardRef(
onBlur={handleBlur}
onFocus={handleFocus}
onInput={(e: any) => {
console.log('eeeeee', e.detail.value)
handleInput((e.currentTarget || e.detail).value)
handleInput((e.detail || e.currentTarget).value)
}}
/>
<View
Expand All @@ -262,10 +260,7 @@ export const Input = forwardRef(
}
}}
>
{clearIcon ||
(!harmonyAndRn() ? (
<MaskClose className="nut-input-clear" />
) : null)}
{clearIcon || <MaskClose className="nut-input-clear" />}
</View>
</View>
)
Expand Down

0 comments on commit d53f051

Please sign in to comment.