mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-02-09 10:03:36 +00:00
feat: create port input component to reuse
This commit is contained in:
parent
32c939a308
commit
398cfde40c
31
src/pages/PairDevice/ConnectViaIP/PortInput.tsx
Normal file
31
src/pages/PairDevice/ConnectViaIP/PortInput.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import { Input, Text } from '@status-im/components'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import { YStack } from 'tamagui'
|
||||
|
||||
type PortInputProps = {
|
||||
portType: string
|
||||
port: string
|
||||
}
|
||||
|
||||
const PortInput = ({ portType, port }: PortInputProps) => {
|
||||
const dispatch = useDispatch()
|
||||
|
||||
const onPortChange = (value: string) => {
|
||||
if (isNaN(Number(value))) {
|
||||
return
|
||||
}
|
||||
|
||||
dispatch({ type: 'pairDevice/setPort', payload: { value, portType } })
|
||||
}
|
||||
|
||||
return (
|
||||
<YStack space={'$2'} flexBasis={0} flexGrow={3}>
|
||||
<Text size={13} color={'#647084'} weight={'semibold'}>
|
||||
{portType} Port
|
||||
</Text>
|
||||
<Input value={port} onChangeText={onPortChange} />
|
||||
</YStack>
|
||||
)
|
||||
}
|
||||
|
||||
export default PortInput
|
Loading…
x
Reference in New Issue
Block a user