feat(validator-setting-card): card constants

This commit is contained in:
RadoslavDimchev 2024-03-25 22:15:14 +02:00 committed by Emil Ivanichkov
parent 327e8659ea
commit 19f7266598
1 changed files with 7 additions and 5 deletions

View File

@ -3,18 +3,20 @@ import { DisconnectIcon, AdvancedIcon, ExternalIcon } from '@status-im/icons'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { Stack, YStack } from 'tamagui' import { Stack, YStack } from 'tamagui'
type IconKey = 'Exit Validator' | 'Migrate Validator' | 'Advanced' import { CARD_TITLES } from '../../../constants'
type CardTitle = (typeof CARD_TITLES)[number]
type ValidatorSettingCardProps = { type ValidatorSettingCardProps = {
title: IconKey title: CardTitle
} }
const ValidatorSettingCard = ({ title }: ValidatorSettingCardProps) => { const ValidatorSettingCard = ({ title }: ValidatorSettingCardProps) => {
const navigate = useNavigate() const navigate = useNavigate()
const getIcon = { const getIcon = {
'Exit Validator': <DisconnectIcon size={20} />, Exit: <DisconnectIcon size={20} />,
'Migrate Validator': <ExternalIcon size={20} />, Migrate: <ExternalIcon size={20} />,
Advanced: <AdvancedIcon size={20} />, Advanced: <AdvancedIcon size={20} />,
} }
@ -35,7 +37,7 @@ const ValidatorSettingCard = ({ title }: ValidatorSettingCardProps) => {
width: 'fit-content', width: 'fit-content',
}} }}
> >
{getIcon[title]} {getIcon[title as keyof typeof getIcon]}
</Stack> </Stack>
<Text size={15} weight="semibold" color="#647084"> <Text size={15} weight="semibold" color="#647084">
{title} {title}