Skip to content

Commit

Permalink
Rename SnapshotCard prop
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Dec 2, 2024
1 parent d4f1009 commit b7236dc
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changelog/1640.trivial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Minor styles updates:

- remove custom styling in tokens Snapshots cards
- use new prop in Consensus Snapshot cards
- sync table header styles with Figma
12 changes: 6 additions & 6 deletions src/app/components/Snapshots/SnapshotCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type SnapshotCardProps = PropsWithChildren & {
label?: ReactNode
title: ReactNode
withContentPadding?: boolean
withConstantHeight?: boolean
alignWithCardsWithActions?: boolean
}

export const SnapshotCard: FC<SnapshotCardProps> = ({
Expand All @@ -42,13 +42,13 @@ export const SnapshotCard: FC<SnapshotCardProps> = ({
title,
label,
withContentPadding = true,
withConstantHeight = false,
alignWithCardsWithActions = false,
}) => {
return (
<StyledCard>
<CardHeader component="h5" title={title} sx={{ pb: 0, pl: 4, pt: 4 }} />
<StyledCardContent withContentPadding={withContentPadding}>{children}</StyledCardContent>
{(badge || label || withConstantHeight) && (
{(badge || label || alignWithCardsWithActions) && (
<CardActions sx={{ minHeight: 60 }}>
<Box
sx={{
Expand Down Expand Up @@ -82,22 +82,22 @@ type SnapshotTextCardProps = {
label?: ReactNode
title: ReactNode
withContentPadding?: boolean
withConstantHeight?: boolean
alignWithCardsWithActions?: boolean
}

export const SnapshotTextCard: FC<SnapshotTextCardProps> = ({
children,
label,
title,
withContentPadding,
withConstantHeight,
alignWithCardsWithActions,
}) => {
return (
<SnapshotCard
title={title}
label={label}
withContentPadding={withContentPadding}
withConstantHeight={withConstantHeight}
alignWithCardsWithActions={alignWithCardsWithActions}
>
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%' }}>
<Typography
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const SnapshotDelegators: FC<SnapshotDelegatorsProps> = ({ totalDelegator
const { t } = useTranslation()

return (
<SnapshotTextCard title={t('validator.delegators')} withConstantHeight>
<SnapshotTextCard title={t('validator.delegators')} alignWithCardsWithActions>
{typeof totalDelegators === 'number' && totalDelegators.toLocaleString()}
</SnapshotTextCard>
)
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/ConsensusDashboardPage/SnapshotStaked.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const SnapshotStaked: FC<SnapshotStakedProps> = ({ totalStaked, ticker })
</Box>
)
}
withConstantHeight
alignWithCardsWithActions
>
{totalStaked && (
<Box sx={{ wordBreak: 'break-all', lineHeight: 1 }}>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/TokenDashboardPage/TokenGasUsedCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const TokenGasUsedCard: FC<{ scope: SearchScope; address: string }> = ({
const { account, isFetched } = useAccount(scope, address)

return (
<SnapshotCard title={t('common.gasUsed')} withConstantHeight>
<SnapshotCard title={t('common.gasUsed')} alignWithCardsWithActions>
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%' }}>
{isFetched && (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/TokenDashboardPage/TokenHoldersCountCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const TokenHoldersCountCard: FC<{ scope: SearchScope; address: string }>

const title = t('tokens.holders')
return (
<SnapshotTextCard title={title} withConstantHeight>
<SnapshotTextCard title={title} alignWithCardsWithActions>
{isLoading ? (
<Skeleton variant="text" />
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const TokenTotalTransactionsCard: FC<{ scope: SearchScope; address: strin
const { isLoading, token, isFetched } = useTokenInfo(scope, address)

return (
<SnapshotTextCard title={t('common.transfers')} withConstantHeight>
<SnapshotTextCard title={t('common.transfers')} alignWithCardsWithActions>
{isLoading ? (
<Skeleton variant="text" />
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/TokenDashboardPage/TokenTypeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const TokenTypeCard: FC<{ scope: SearchScope; address: string }> = ({ sco
const { isLoading, token, isFetched } = useTokenInfo(scope, address)

return (
<SnapshotCard title={t('common.type')} withConstantHeight>
<SnapshotCard title={t('common.type')} alignWithCardsWithActions>
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%' }}>
{isLoading ? (
<Skeleton variant="text" sx={{ width: '50%' }} />
Expand Down

0 comments on commit b7236dc

Please sign in to comment.