mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-02-15 21:06:50 +00:00
feat: add function handlers
This commit is contained in:
parent
10f66214a1
commit
a468f3283c
@ -14,6 +14,22 @@ const AddressAndPortInputs = ({ addressType, portType, isAdvanced }: AddressAndP
|
|||||||
const [port, setPort] = useState('')
|
const [port, setPort] = useState('')
|
||||||
const [isChecked, setIsChecked] = useState(false)
|
const [isChecked, setIsChecked] = useState(false)
|
||||||
|
|
||||||
|
const onSwitchChangeHandler = () => {
|
||||||
|
setIsSwitchOn(state => !state)
|
||||||
|
}
|
||||||
|
|
||||||
|
const onAddressChangeHandler = (value: string) => {
|
||||||
|
setAddress(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
const onPortChangeHandler = (value: string) => {
|
||||||
|
setPort(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
const onCheckboxChangeHandler = () => {
|
||||||
|
setIsChecked(state => !state)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<YStack>
|
<YStack>
|
||||||
<XStack justifyContent={'space-between'}>
|
<XStack justifyContent={'space-between'}>
|
||||||
@ -30,7 +46,7 @@ const AddressAndPortInputs = ({ addressType, portType, isAdvanced }: AddressAndP
|
|||||||
size="$1"
|
size="$1"
|
||||||
style={isSwitchOn ? { backgroundColor: '#2A4AF5' } : { backgroundColor: 'grey' }}
|
style={isSwitchOn ? { backgroundColor: '#2A4AF5' } : { backgroundColor: 'grey' }}
|
||||||
checked={isSwitchOn}
|
checked={isSwitchOn}
|
||||||
onCheckedChange={() => setIsSwitchOn(prev => !prev)}
|
onCheckedChange={onSwitchChangeHandler}
|
||||||
>
|
>
|
||||||
<Switch.Thumb
|
<Switch.Thumb
|
||||||
style={{
|
style={{
|
||||||
@ -47,7 +63,7 @@ const AddressAndPortInputs = ({ addressType, portType, isAdvanced }: AddressAndP
|
|||||||
<Text size={11} color={'#647084'} weight={'regular'}>
|
<Text size={11} color={'#647084'} weight={'regular'}>
|
||||||
{addressType || 'Node'} Address
|
{addressType || 'Node'} Address
|
||||||
</Text>
|
</Text>
|
||||||
<Input placeholder={''} value={address} onChangeText={e => setAddress(e)} />
|
<Input placeholder={''} value={address} onChangeText={onAddressChangeHandler} />
|
||||||
</YStack>
|
</YStack>
|
||||||
{isAdvanced === false ? (
|
{isAdvanced === false ? (
|
||||||
<></>
|
<></>
|
||||||
@ -56,7 +72,7 @@ const AddressAndPortInputs = ({ addressType, portType, isAdvanced }: AddressAndP
|
|||||||
<Text size={11} color={'#647084'} weight={'regular'}>
|
<Text size={11} color={'#647084'} weight={'regular'}>
|
||||||
{portType} Port
|
{portType} Port
|
||||||
</Text>
|
</Text>
|
||||||
<Input value={port} onChangeText={e => setPort(e)} />
|
<Input value={port} onChangeText={onPortChangeHandler} />
|
||||||
</YStack>
|
</YStack>
|
||||||
)}
|
)}
|
||||||
<Stack
|
<Stack
|
||||||
@ -69,7 +85,7 @@ const AddressAndPortInputs = ({ addressType, portType, isAdvanced }: AddressAndP
|
|||||||
id="AddressAndPortInputs"
|
id="AddressAndPortInputs"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
selected={isChecked}
|
selected={isChecked}
|
||||||
onCheckedChange={() => setIsChecked(prev => !prev)}
|
onCheckedChange={onCheckboxChangeHandler}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user