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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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