Skip to content

feat: add compact variant to MetricCard for condensed single-line KPI display [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT] - #1356

Closed
waterWang wants to merge 1 commit into
Fluxora-Org:mainfrom
waterWang:feat/metric-card-compact-variant-1271
Closed

feat: add compact variant to MetricCard for condensed single-line KPI display [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT]#1356
waterWang wants to merge 1 commit into
Fluxora-Org:mainfrom
waterWang:feat/metric-card-compact-variant-1271

Conversation

@waterWang

Copy link
Copy Markdown

Summary

Adds a variant="compact" prop to the MetricCard component that collapses the full multi-line layout to a single-row label/value pair for use in tighter layouts such as a condensed dashboard header strip.

Changes

  • src/components/treasuryOverviewPage/MetricCard.tsx:

    • Added MetricCardVariant type ("default" | "compact")
    • Added variant prop to MetricCardProps (defaults to "default")
    • Compact variant renders icon + label + value in a single flex-row layout
    • Compact variant uses reduced padding (var(--space-sm) var(--space-md))
    • Description, trend/sparkline are hidden in compact mode
    • Default variant unchanged
  • src/components/treasuryOverviewPage/MetricCard.test.tsx:

    • Added 4 tests for compact variant behaviour

Design Decisions

  • Uses existing design tokens only (no hardcoded values)
  • aria-label on the card wrapper is preserved for screen readers
  • Icon is marked aria-hidden="true" in compact mode (decorative)
  • Label uses text-overflow: ellipsis for long labels in constrained spaces

Closes #1271

… display

Add variant='compact' prop to MetricCard component that collapses
the full multi-line layout to a single-row label/value pair for
use in tighter layouts such as a condensed dashboard header strip.

- Default variant ('default') remains unchanged
- Compact variant uses reduced padding and row flex-direction
- Desc, trend, sparkline are hidden in compact mode
- Uses existing design tokens (no hardcoded values)
- Preserves semantic markup for screen readers

Closes Fluxora-Org#1271
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a variant="compact" prop to src/components/treasuryOverviewPage/MetricCard.tsx for condensed single-line KPI display

2 participants