Repository navigation
Description
[DRAFT][PLAN] Scorecard: add subtitle prop
Plan for parent issue #223.
Reference files mapped
packages/ui/src/components/Scorecard.tsx— component to modify. Already colocatesScorecardLabelText,ScorecardTrendText,ScorecardAffixTextas privatecreateComponent(TamaguiText, ...)styled sub-components — subtitle follows the identical pattern.examples/storybook/src/stories/design-system/Scorecard.stories.tsx— story to modify.tests/design-system/smoke.spec.ts— existing'Scorecard/Default story renders...'test; design-system components use this convention (nottests/widgets/).packages/ui/src/createComponent.ts— confirms the styled-component wrapper pattern (read-only reference).packages/ui/src/index.ts— already exportsScorecard/ScorecardProps; no edit needed sincesubtitleextends the existing exported type.
No new @GoodDollar packages needed — reuses tamagui's Text/styled, ../createComponent, and existing constants (SECONDARY_SIZE_PX, VALUE_TO_TREND_GAP_PX) already in Scorecard.tsx. No new dependencies.
New component mapping: ScorecardSubtitleText, colocated inside Scorecard.tsx (not a new file, not a new package) — it's a private sub-component of Scorecard's own render tree with no reuse elsewhere, matching the precedent of ScorecardLabelText/ScorecardTrendText/ScorecardAffixText already colocated there. Correctly belongs in packages/ui, not a widget-specific package, since Scorecard itself is already a shared design-system primitive (consumed cross-widget, e.g. the AI-Credits-analytics PR #179).
Required states, flows, and behaviors
- With trend + with subtitle: Label → Value row → Trend row → Subtitle
- With trend, no subtitle: unchanged, byte-for-byte
- No trend + with subtitle: Label → Value row → Subtitle
- No trend, no subtitle: unchanged (current layout), byte-for-byte
- All 3 sizes (
sm/md/lg) and both variants (bare/card) - Cross-platform: React web, React Native, Web Components — guaranteed by the existing
TamaguiText/createComponentpattern, no platform branching needed
Execution plan
Scorecard.tsx- Add
subtitle?: stringtoScorecardProps, aftertrendLabel. - Add
ScorecardSubtitleTextviacreateComponent(TamaguiText, ...):color: '$placeholderColor',fontWeight: '400',textAlign: 'center',variants.size→SECONDARY_SIZE_PX[size],defaultVariants: { size: 'md' }(same shape asScorecardLabelText). - Destructure
subtitleinScorecardContent. - Render
{subtitle ? <ScorecardSubtitleText size={size} marginTop={VALUE_TO_TREND_GAP_PX}>{subtitle}</ScorecardSubtitleText> : null}as the last child inScorecardFrame, after the existing trend block — one conditional naturally satisfies both render-position rules (after trend row when present, after value row when absent).
- Add
Scorecard.stories.tsx- Add
subtitletoargTypes(control: 'text'). - Add
subtitleto oneMOCK_ROWSentry with a trend and one without, in the existingDefaultstory (no new story block needed to satisfy "with and without trend"). - Add
subtitle: ''toControllableargs.
- Add
tests/design-system/smoke.spec.ts- Extend the existing Scorecard test to assert subtitle visibility on the updated rows; re-capture
story-scorecard-default.png.
- Extend the existing Scorecard test to assert subtitle visibility on the updated rows; re-capture
- Manual QA: scoped typecheck/lint, visual check across sizes/variants/trend combos, run smoke spec, commit refreshed baseline.
Acceptance criteria
-
subtitleprop accepted, renders below trend row (or value row if no trend) - No subtitle → no extra whitespace, layout unchanged
- Subtitle uses
$placeholderColor,SECONDARY_SIZE_PX,fontWeight: '400', centered - Gap above subtitle =
VALUE_TO_TREND_GAP_PX - Works in all 3 sizes and both variants
- Works with and without
trend - Storybook story demonstrates subtitle with and without trend
-
ScorecardSubtitleTextviacreateComponent, no new dependencies -
tests/design-system/smoke.spec.tsupdated with subtitle assertions, baseline screenshot refreshed and committed
Human-reviewer checklist
- Render-position rule verified visually for all size × variant × trend combos
- No-subtitle layout is pixel-identical to pre-change (diff the baseline screenshot)
- Only
Scorecard.tsx,Scorecard.stories.tsx, andtests/design-system/smoke.spec.ts(+ its baseline PNG) changed — no edits toCard.ts,index.ts, theme files, or other components - No new dependencies in
package.json/lockfile
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
thalescb commentedon Nov 9, 2026
Delivered in #228, merged Oct 22.
goodbounties-nanoclaw-agent commentedon Nov 10, 2026
Linking the delivering PR for the record: GoodWidget PR #228 (Scorecard subtitle prop), merged 22 Oct 2026, which implements this plan under parent #223. The change is in the shared UI package, which is included in the "Deploy GoodData Web" build on main; the latest production run on main succeeded on 9 Nov 2026.