Add hover effect on Network Card

This commit is contained in:
Hristo Nedelkov 2023-09-27 23:15:51 +03:00
parent e59ba5817a
commit 805a03e335
1 changed files with 7 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import IconText from '../General/IconText'
import { Separator, XStack, YStack } from 'tamagui' import { Separator, XStack, YStack } from 'tamagui'
import { Shadow as ShadowBox, Text } from '@status-im/components' import { Shadow as ShadowBox, Text } from '@status-im/components'
import { CheckCircleIcon, IncorrectIcon } from '@status-im/icons' import { CheckCircleIcon, IncorrectIcon } from '@status-im/icons'
import { useState } from 'react'
type DataPoint = { type DataPoint = {
x: number x: number
@ -20,6 +21,9 @@ type DeviceNetworkHealthProps = {
downloadRate: number[] downloadRate: number[]
} }
const DeviceNetworkHealth = ({ uploadRate, downloadRate }: DeviceNetworkHealthProps) => { const DeviceNetworkHealth = ({ uploadRate, downloadRate }: DeviceNetworkHealthProps) => {
const [isHovered, setIsHovered] = useState(false);
const THRESHOLD = 60; const THRESHOLD = 60;
const GOOD_COLOR = '#8DC6BC'; const GOOD_COLOR = '#8DC6BC';
const POOR_COLOR_UPLOAD = '#e95460'; const POOR_COLOR_UPLOAD = '#e95460';
@ -53,8 +57,10 @@ const DeviceNetworkHealth = ({ uploadRate, downloadRate }: DeviceNetworkHealthPr
minHeight: '135px', minHeight: '135px',
borderRadius: '16px', borderRadius: '16px',
border: upload.message === 'Poor' ? '1px solid #D92344' : 'none', border: upload.message === 'Poor' ? '1px solid #D92344' : 'none',
backgroundColor: upload.message === 'Poor' ? '#fefafa' : '#fff', backgroundColor: isHovered ? '#f8f6ff' : (upload.message === 'Poor' ? '#fefafa' : '#fff'),
}} }}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
> >
<YStack> <YStack>
<XStack <XStack