feat(deposit-panel): add input amount with state

This commit is contained in:
RadoslavDimchev 2024-02-26 13:03:00 +02:00 committed by Emil Ivanichkov
parent 2718212c27
commit c5ac515424
2 changed files with 34 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import { InformationBox, Text } from '@status-im/components' import { InformationBox, Input, Text } from '@status-im/components'
import { PlaceholderIcon } from '@status-im/icons' import { ClearIcon, PlaceholderIcon } from '@status-im/icons'
import { YStack } from 'tamagui' import { Stack, YStack } from 'tamagui'
import { useState } from 'react' import { useState } from 'react'
import { useSelector } from 'react-redux' import { useSelector } from 'react-redux'
@ -13,6 +13,7 @@ import ValidatorRequest from '../../../../ValidatorOnboarding/Deposit/ValidatorR
const DepositPanel = () => { const DepositPanel = () => {
const [isInfoBoxVisible, setIsInfoBoxVisible] = useState(true) const [isInfoBoxVisible, setIsInfoBoxVisible] = useState(true)
const [depositAmount, setDepositAmount] = useState('')
const { isWalletConnected, isTransactionConfirmation, isChainParity } = const { isWalletConnected, isTransactionConfirmation, isChainParity } =
useSelector((state: RootState) => state.deposit) useSelector((state: RootState) => state.deposit)
@ -20,6 +21,17 @@ const DepositPanel = () => {
setIsInfoBoxVisible(false) setIsInfoBoxVisible(false)
} }
const changeDepositAmountHandler = (value: string) => {
const numberValue = Number(value)
if (isNaN(numberValue) === false) {
setDepositAmount(value)
}
}
const removeDepositAmountHandler = () => {
setDepositAmount('')
}
return ( return (
<PanelWrapper title={'Deposit Funds'}> <PanelWrapper title={'Deposit Funds'}>
{isChainParity ? ( {isChainParity ? (
@ -31,6 +43,23 @@ const DepositPanel = () => {
width: '100%', width: '100%',
}} }}
> >
<Stack space={'$2'}>
<Text size={15} weight="regular" color={'#647084'}>
Deposit validator
</Text>
<Input
icon={
<ClearIcon
size={16}
style={{ cursor: 'pointer' }}
onClick={removeDepositAmountHandler}
/>
}
placeholder="Deposit Amount"
value={depositAmount}
onChangeText={changeDepositAmountHandler}
/>
</Stack>
<ValidatorRequest <ValidatorRequest
key={2} key={2}
name={'2'} name={'2'}

View File

@ -4,8 +4,8 @@ import MigratePanel from './Panels/MigratePanel'
const RightManageSettings = () => { const RightManageSettings = () => {
const isDefault = false const isDefault = false
const isMigrate = true const isMigrate = false
const isDeposit = false const isDeposit = true
return ( return (
<div style={{ flexGrow: 1 }}> <div style={{ flexGrow: 1 }}>