fix(dashboard-card-wrapper): pass style instead of style props

This commit is contained in:
RadoslavDimchev 2024-04-20 16:59:33 +03:00 committed by Emil Ivanichkov
parent 57d98fc83c
commit e08fab7a80
12 changed files with 31 additions and 37 deletions

View File

@ -10,7 +10,7 @@ type AddCardsContainerProps = {
const AddCardsContainer = ({ cardsAmount }: AddCardsContainerProps) => {
return (
<DashboardCardWrapper padding="0" minWidth="50px">
<DashboardCardWrapper style={{ padding: 0, minWidth: '50px' }}>
<YStack height={'100%'}>
{Array.from({ length: cardsAmount }).map((_, index) => (
<AddCard

View File

@ -3,12 +3,16 @@ import { Separator, Stack, XStack, YStack } from 'tamagui'
import DashboardCardWrapper from '../DashboardCardWrapper'
import Icon from '../../../components/General/Icon'
type ActiveValidatorsProps = {
count: number
}
const ActiveValidators = ({ count }: ActiveValidatorsProps) => {
return (
<DashboardCardWrapper padding="0" height="156px" minWidth="250px">
<DashboardCardWrapper
style={{ padding: 0, height: '156px', minWidth: '250px' }}
>
<img
src="/images/validators-count.png"
alt=""

View File

@ -41,7 +41,9 @@ const BalanceChartCard = () => {
}
return (
<DashboardCardWrapper minWidth={'436px'} width="100%" height="100%">
<DashboardCardWrapper
style={{ width: '100%', height: '100%', minWidth: '436px' }}
>
<YStack space={'$4'}>
<XStack justifyContent={'space-between'}>
<YStack>

View File

@ -43,9 +43,7 @@ const CPUCard = ({ load }: CPUCardProps) => {
return (
<DashboardCardWrapper
padding="0"
height="156px"
minWidth="200px"
style={{ padding: 0, height: '156px', minWidth: '250px' }}
isErrorBorder={message === 'Poor'}
>
<YStack

View File

@ -6,7 +6,9 @@ import DoughnutChartHalf from '../../../components/Charts/HalfDoughnutWithGradie
const ConnectedPeers = () => {
return (
<DashboardCardWrapper padding="0" height="156ppx" minWidth="250px">
<DashboardCardWrapper
style={{ padding: 0, height: '156px', minWidth: '250px' }}
>
<YStack height={'100%'}>
<Stack
style={{ minHeight: '90px', padding: '12px 16px', flex: 1 }}

View File

@ -59,7 +59,7 @@ const Dashboard = () => {
<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(4, 1fr)', // Four columns, each taking up an equal portion of the available space
gridTemplateColumns: 'repeat(4, 1fr)',
gap: '14px',
width: '100%',
}}

View File

@ -2,39 +2,27 @@ import { Shadow } from '@status-im/components'
type DashboardCardWrapperProps = {
children: React.ReactNode
padding?: string
width?: string
height?: string
minWidth?: string
maxWidth?: string
maxHeight?: string
isErrorBorder?: boolean
style?: React.CSSProperties
}
const DashboardCardWrapper = ({
children,
padding = '12px 16px',
width,
height = 'auto',
minWidth = '0',
maxWidth,
maxHeight,
isErrorBorder,
style,
}: DashboardCardWrapperProps) => {
return (
<Shadow
variant="$1"
style={{
flexGrow: '1',
width: width,
height: height,
borderRadius: '16px',
padding,
backgroundColor: '$background',
minWidth: minWidth,
maxWidth: maxWidth,
maxHeight: maxHeight,
border: isErrorBorder ? '1px solid #D92344' : '1px solid #E7EAEE',
padding: '12px 16px',
height: 'auto',
minWidth: '0',
...style,
}}
>
{children}

View File

@ -31,7 +31,7 @@ const DeviceUptime = () => {
}
return (
<DashboardCardWrapper minWidth="100px">
<DashboardCardWrapper style={{ minWidth: '100px' }}>
<YStack space={'$3'}>
<XStack justifyContent={'space-between'}>
<YStack>

View File

@ -45,9 +45,7 @@ const MemoryCard = ({ currentMemory, maxMemory }: MemoryCardProps) => {
return (
<DashboardCardWrapper
padding="0"
height="156px"
minWidth="200px"
style={{ padding: 0, height: '156px', minWidth: '250px' }}
isErrorBorder={message === 'Poor'}
>
<YStack

View File

@ -51,9 +51,11 @@ const NetworkCard = ({ uploadRate, downloadRate }: NetworkCardProps) => {
return (
<DashboardCardWrapper
padding="0"
height="156px"
minWidth="200px"
style={{
padding: 0,
height: '156px',
minWidth: '200px',
}}
isErrorBorder={message === 'Poor'}
>
<YStack

View File

@ -36,9 +36,7 @@ const StorageCard = ({ storage, maxStorage }: StorageCardProps) => {
return (
<DashboardCardWrapper
padding="0"
height="156px"
minWidth="200px"
style={{ padding: 0, height: '156px', minWidth: '200px' }}
isErrorBorder={message === 'Poor'}
>
<YStack

View File

@ -7,7 +7,9 @@ import ConsensusCard from './ConsensusClientCard'
const SyncStatusCards = () => {
return (
<DashboardCardWrapper padding="0" minWidth="200px" height="100%">
<DashboardCardWrapper
style={{ padding: 0, height: '100%', minWidth: '200px' }}
>
<YStack space={'$3'}>
<div style={{ padding: '8px 16px' }}>
<Text size={19} weight={'semibold'}>