feat(validator-setting-card): add navigate to panel

This commit is contained in:
RadoslavDimchev 2024-03-24 20:15:48 +02:00 committed by Emil Ivanichkov
parent 9b7cf9febd
commit 327e8659ea
1 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import { Text } from '@status-im/components' import { Text } from '@status-im/components'
import { DisconnectIcon, AdvancedIcon, ExternalIcon } from '@status-im/icons' import { DisconnectIcon, AdvancedIcon, ExternalIcon } from '@status-im/icons'
import { useNavigate } from 'react-router-dom'
import { Stack, YStack } from 'tamagui' import { Stack, YStack } from 'tamagui'
type IconKey = 'Exit Validator' | 'Migrate Validator' | 'Advanced' type IconKey = 'Exit Validator' | 'Migrate Validator' | 'Advanced'
@ -9,14 +10,23 @@ type ValidatorSettingCardProps = {
} }
const ValidatorSettingCard = ({ title }: ValidatorSettingCardProps) => { const ValidatorSettingCard = ({ title }: ValidatorSettingCardProps) => {
const navigate = useNavigate()
const getIcon = { const getIcon = {
'Exit Validator': <DisconnectIcon size={20} />, 'Exit Validator': <DisconnectIcon size={20} />,
'Migrate Validator': <ExternalIcon size={20} />, 'Migrate Validator': <ExternalIcon size={20} />,
Advanced: <AdvancedIcon size={20} />, Advanced: <AdvancedIcon size={20} />,
} }
const onNavigateToPanel = () => {
if (title === 'Advanced') {
return
}
navigate(`${title.toLowerCase()}`)
}
return ( return (
<YStack alignItems="center"> <YStack alignItems="center" cursor="pointer" onPress={onNavigateToPanel}>
<Stack <Stack
style={{ style={{
border: '0.5px solid #DCE0E5', border: '0.5px solid #DCE0E5',