Repository navigation
feat(ui): add subtitle prop to Scorecard - #228
Conversation
Adds an optional subtitle line to Scorecard, rendered below the trend row when a trend is present or below the value row otherwise. No change to layout when subtitle is omitted. Closes #223 On-Behalf-Of: BountyCoder[onecli] (yaskkeryodtdijpv)
There was a problem hiding this comment.
Pull request overview
Adds an optional subtitle prop to the shared Scorecard design-system component (packages/ui) to allow a short contextual/source note that renders beneath the metric (after the trend row when present, otherwise after the value row) without affecting layout when omitted.
Changes:
- Extended
ScorecardPropswithsubtitle?: stringand added aScorecardSubtitleTextstyled sub-component for consistent typography/colors. - Updated the Scorecard Storybook story data and controls to demonstrate subtitle usage with and without a trend.
- Extended the existing Playwright smoke test to assert the subtitle renders for both a with-trend and no-trend row, and adjusted viewport height for the extra line.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/ui/src/components/Scorecard.tsx | Adds subtitle prop and renders it conditionally using a new ScorecardSubtitleText component. |
| examples/storybook/src/stories/design-system/Scorecard.stories.tsx | Updates mock rows and Storybook controls to demonstrate subtitle in both trend/no-trend cases. |
| tests/design-system/smoke.spec.ts | Adds assertions for subtitle rendering and increases viewport height to avoid clipping. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
@copilot Please resolve only the screenshot conflict in tests/design-system/test-results/story-scorecard-default.png on PR #228. Regenerate the screenshot on this PR branch. Leave packages/ui/src/components/Scorecard.tsx, examples/storybook/src/stories/design-system/Scorecard.stories.tsx, tests/design-system/smoke.spec.ts, and all other files unchanged. Do not merge. Report the files changed and the checks run. If resolving the screenshot requires changing any other file or a check fails, stop and report the blocker. |
|
@copilot Please resolve only the screenshot conflict in tests/design-system/test-results/story-scorecard-default.png on PR #228. Regenerate the screenshot on this PR branch. Leave packages/ui/src/components/Scorecard.tsx, examples/storybook/src/stories/design-system/Scorecard.stories.tsx, tests/design-system/smoke.spec.ts, and all other files unchanged. Do not merge. Report the files changed and the checks run. If resolving the screenshot requires changing other files, or any check fails, stop and report the blocker. |
|
@copilot Please resolve only the screenshot conflict in tests/design-system/test-results/story-scorecard-default.png on PR #228. Regenerate the screenshot on this PR branch. Leave packages/ui/src/components/Scorecard.tsx, examples/storybook/src/stories/design-system/Scorecard.stories.tsx, tests/design-system/smoke.spec.ts, and all other files unchanged. Do not merge. Report the files changed and the checks run. If resolving the screenshot requires changing any other file or a check fails, stop and report the blocker. |
Stopped because the targeted check failed: Files changed: none (confirmed with |
…recard-subtitle-prop
Description
Adds an optional
subtitleprop toScorecard(packages/ui) — a short contextual/source note rendered below the trend row when a trend is present, or directly below the value row when it is not. Layout is unchanged whensubtitleis omitted.About #223
How Has This Been Tested?
tests/design-system/smoke.spec.ts(Scorecard story test) with assertions that the subtitle text renders for both the with-trend row (unique-wallets) and without-trend row (daily-flow-rate), and regenerated the tracked baseline screenshottests/design-system/test-results/story-scorecard-default.png.tests/design-system/smoke.spec.tssuite locally (45 tests across Card, GlowCard, Drawer, TokenAmount, ClaimWidget, ThemePlayground, Stepper, Scorecard, PieDonutChart, BarChart, LineAreaChart, DataTable) — all passed, no regressions.packages/uiviapnpm build(tsup) — ESM/CJS/DTS all succeeded, confirming the prop and new sub-component type-check.Checklist:
Plan sub-issue: #225