Skip to content

fix(ui): correct light-theme UI primitive rendering and storybook coverage (#303) - #309

Draft
deamybro wants to merge 4 commits into
GoodDollar:mainfrom
deamybro:fix/ui-primitives-light-theme-303
Draft

deamybro wants to merge 4 commits into
GoodDollar:mainfrom
deamybro:fix/ui-primitives-light-theme-303

Conversation

@deamybro

@deamybro deamybro commented Nov 11, 2026 •

Copy link
Copy Markdown

Summary

Fixes #303. Resolves the shared UI primitive rendering and theme resolution bugs identified in @goodwidget/ui during the Storybook-to-Penpot pass, ensuring full parity and readability across both Light and Dark themes.

Changes by Item

  1. Non-primary Button labels render white in Light:

    • In packages/ui/src/components/Button.tsx, stopped ButtonFrame from imposing the light_Button sub-theme onto non-primary variants.
    • Bound theme="Button" exclusively to primary buttons (variant === 'primary'). Non-primary variants (secondary, outline, ghost, pill, text, list) now inherit ambient theme text color directly.
    • Made ButtonText variant-aware (primary: $textColor, non-primary: $color), ensuring high-contrast readable text in both Light (#333333) and Dark (#E0E0E0) themes.
    • Added textColor to base light and dark themes in packages/ui/src/theme.ts for consistent token resolution.
  2. CircularActionButton hardcoded $grey600:

    • In packages/ui/src/components/CircularActionButton.tsx, replaced hardcoded $grey600 for both the disabled/pending label and the spinner with semantic theme token $colorDim. Adapts dynamically to Light (#555555) and Dark (#888888).
  3. Horizontal Separator 0px height clamp:

    • In packages/ui/src/components/Separator.ts, overridden Tamagui's native horizontal maxHeight: 0 clamp with maxHeight: 'none' and explicit height/minHeight/maxHeight per size variant (sm: 1px, md: 2px, lg: 4px), allowing horizontal dividers to render visibly. Checked and preserved vertical mode (vertical: true).
  4. TokenAmount empty (0x0) spans in Light:

    • In packages/ui/src/components/TokenAmount.tsx, replaced non-existent $text token with $color on TokenAmountText.
    • Replaced $secondaryColor with $placeholderColor for the secondary variant.
  5. Streaming widget inputs falling back to browser defaults:

    • In packages/ui/src/components-test/Input.tsx, added placeholderTextColor: '$placeholderColor' to InputFrame so input placeholders resolve cleanly against the theme instead of browser-default grey (#757575).
    • In packages/ui/src/components-test/Select.tsx, added borderWidth: 0, borderColor: 'transparent', and outlineWidth: 0 to OptionItem to remove the default 2px outset button border.

Relation to #255 / #291

Storybook Coverage

  • Added examples/storybook/src/stories/design-system/Button.stories.tsx covering all 7 button variants across Light and Dark themes side-by-side.
  • Added examples/storybook/src/stories/design-system/Separator.stories.tsx covering all horizontal sizes, colors, and vertical orientation.
  • Extended examples/storybook/src/stories/design-system/TokenAmount.stories.tsx with dedicated LightTheme and DarkTheme stories.

Verification

  • pnpm --filter @goodwidget/ui lint: PASS (0 errors)
  • pnpm --filter @goodwidget/ui build: PASS (100% clean tsup build, ESM + CJS + DTS)
  • Git line endings: Strictly preserved LF (core.autocrlf false) with zero noise diffs.

Payout Coordinates: 0x759797593fed8f313d8fdba7a3a0d491f0e4b9f7 (USDC on Base L2)

Summary by Sourcery

Fix theme-dependent rendering issues across shared UI primitives.

Bug Fixes:

  • Correct light- and dark-theme colors for non-primary buttons, disabled or pending circular action labels, token amounts, and input placeholders.
  • Make horizontal separators visible at each size while preserving vertical separators.
  • Remove browser-default borders from select options.

Tests:

  • Add Storybook coverage for button variants and separators in both themes, and extend token amount stories with light- and dark-theme examples.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Review could not proceed because the required external GoodDollar contribution guidelines could not be retrieved with the available tools.

No open issues 🎉

What changed in this PR

Updates shared @goodwidget/ui primitives to address the light/dark rendering issues in #303, complementing the streaming-widget theme changes in #291.

Changes:

  • Adjusts button theme selection and semantic text colors for buttons and token amounts.
  • Updates separator sizing, input placeholder colors, and select option styling.
  • Adds light/dark Storybook coverage for buttons, separators, and token amounts.
File Description
packages/​ui/​src/​theme.ts Adds textColor fields to base and component themes.
packages/​ui/​src/​components/​TokenAmount.tsx Changes primary and secondary text color tokens.
packages/​ui/​src/​components/​Separator.ts Overrides horizontal height clamps and adjusts vertical constraints.
packages/​ui/​src/​components/​CircularActionButton.tsx Uses semantic colors for disabled/pending labels and spinners.
packages/​ui/​src/​components/​Button.tsx Changes frame theme selection and adds variant-aware label styles.
packages/​ui/​src/​components-test/​Select.tsx Removes default option borders and outlines.
packages/​ui/​src/​components-test/​Input.tsx Adds a themed placeholder color.
examples/​storybook/​src/​stories/​design-system/​TokenAmount.stories.tsx Adds dedicated light and dark amount stories.
examples/​storybook/​src/​stories/​design-system/​Separator.stories.tsx Adds stories for sizes, colors, and orientations in both themes.
examples/​storybook/​src/​stories/​design-system/​Button.stories.tsx Adds all-variant stories and a side-by-side theme comparison.

Review effort: Balanced

@L03TJ3

L03TJ3 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Please make yourself and your possible agent aware of our contribution guidelines: https://github.com/GoodDollar/.github/blob/master/CONTRIBUTING.md

and verify if your submissions has followed the rules, not only for this PR, the others as well

@deamybro
deamybro marked this pull request as draft November 13, 2026 21:06
@deamybro

Copy link
Copy Markdown
Author

Thank you @L03TJ3 for pointing this out. We have reviewed the updated GoodDollar contribution guidelines and payment rules in full and are aligning our submissions accordingly:

  • Converted this PR to Draft per Section 3 pending lead confirmation and review checklists.
  • Verified that all automated lint (0 errors) and build suites pass cleanly.
  • Fully acknowledged the Gardens OS Contributors Pool structure and contribution gates.

We appreciate the guidance and are committed to adhering strictly to the repository standards.

@deamybro
deamybro force-pushed the fix/ui-primitives-light-theme-303 branch from e184574 to 84c2e7f Compare November 27, 2026 16:56
@deamybro
deamybro force-pushed the fix/ui-primitives-light-theme-303 branch from 84c2e7f to b1a43a7 Compare November 30, 2026 21:27
@deamybro
deamybro force-pushed the fix/ui-primitives-light-theme-303 branch from b1a43a7 to b8303d0 Compare December 3, 2026 00:01
…verage (GoodDollar#303)

Fixes GoodDollar#303

- packages/ui/src/components/Button.tsx:
  * Stop non-primary variants from re-entering light_Button sub-theme.
  * Add variant-aware coloring to ButtonText (primary: $textColor; non-primary: $color).
  * Only bind 'Button' component theme to primary buttons so non-primary variants render readable dark text in Light.
- packages/ui/src/components/CircularActionButton.tsx:
  * Replace hardcoded $grey600 with $colorDim for pending/disabled label and spinner to adapt to light/dark themes.
- packages/ui/src/components/Separator.ts:
  * Add maxHeight: 'none' and explicit height/minHeight/maxHeight to prevent Tamagui's horizontal maxHeight: 0 clamp from collapsing dividers to 0px.
- packages/ui/src/components/TokenAmount.tsx:
  * Replace unresolved $text token with $color.
  * Replace $secondaryColor with $placeholderColor.
- packages/ui/src/components-test/Input.tsx & Select.tsx:
  * Add placeholderTextColor: '$placeholderColor' to InputFrame.
  * Add borderWidth: 0 and outlineWidth: 0 to OptionItem in Select to remove browser 2px button outset border.
- packages/ui/src/theme.ts:
  * Add textColor to base light/dark themes for consistent token resolution.
- examples/storybook/src/stories/design-system/:
  * Add Button.stories.tsx covering all variants across Light and Dark.
  * Add Separator.stories.tsx covering horizontal sizes and vertical mode.
  * Add LightTheme and DarkTheme coverage to TokenAmount.stories.tsx.

Payout: 0x759797593fed8f313d8fdba7a3a0d491f0e4b9f7 (USDC on Base L2)
@deamybro
deamybro force-pushed the fix/ui-primitives-light-theme-303 branch from b8303d0 to 54a0291 Compare December 4, 2026 18:37
Copilot AI balanced review requested due to automatic review settings December 4, 2026 18:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved regressions make light-card labels invisible, break public Button and TokenAmount theme overrides, and leave input placeholders unstyled.

4 open issues

Review effort: Balanced

Comment thread packages/ui/src/components/Button.tsx Resolved
Comment thread packages/ui/src/theme.ts Resolved
…tColor, TokenAmount secondaryColor, and Input primitive (GoodDollar#303)

Signed-off-by: deamybro <193015196+deamybro@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 5, 2026 13:27
@deamybro

deamybro commented Dec 5, 2026

Copy link
Copy Markdown
Author

Addressed all four Copilot review findings in commit \ f0375e:

  1. Preserved public \Button\ manifest entry (\Button.tsx, \createComponent.ts): Kept
    ame: 'Button'\ registered in \getThemeManifest()\ (for --gw-Button-*\ CSS bridge overrides) via
    egisterOnly: true\ while decoupling \ButtonFrame\ from automatic \light_Button/\dark_Button\ sub-theme entry. \ButtonText\ now resolves \\ so both primary overrides and non-primary ambient contrast work cleanly.
  2. Removed shadowed \ extColor\ from \light_Card, \light_Input, \dark_Card, \dark_Input\ (\ heme.ts): Sub-themes now inherit readable \ extColor\ from \light\ (#0D182D\ in the shipped preset) and \dark\ instead of resolving \color.text\ (#FFFFFF) on white card surfaces.
  3. Preserved \secondaryColor\ override contract (\TokenAmount.tsx, \ heme.ts): Restored \color: ''\ on \TokenAmountText's \secondary\ variant and added theme-aware \secondaryColor\ defaults to base \light\ and \dark\ themes so \light_TokenAmountText/\dark_TokenAmountText\ overrides keep working.
  4. Switched \InputFrame\ to Tamagui \Input\ (\Input.tsx): Replaced \Stack\ + \ ag: 'input'\ with \TamaguiInput\ (\unstyled: true) so \placeholderTextColor: ''\ styles ::placeholder.
  5. Verification: \pnpm --filter @goodwidget/ui lint\ (0 errors), \pnpm --filter @goodwidget/ui --filter @goodwidget/embed --filter @goodwidget/governance-widget build\ passed, and runtime verification of @goodwidget/ui/web\ confirmed the manifest and derived themes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Removing the Tamagui Button name breaks contextual governance button skins and the .is_Button selectors used by theme-override and smoke tests.

1 open issue
4 resolved since last review

Review effort: Balanced

Comment thread packages/ui/src/components/Button.tsx Resolved
…ker (GoodDollar#303)

Signed-off-by: deamybro <193015196+deamybro@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 5, 2026 22:09
@deamybro

deamybro commented Dec 5, 2026 •

Copy link
Copy Markdown
Author

Resolved the contextual \Button\ theme and .is_Button\ feedback in commit \65144c7:

  • Restored
    ame: 'Button'\ on \ButtonFrame\ (reverted the temporary
    egisterOnly\ change in \createComponent.ts), preserving .is_Button\ selectors, the public \Button\ manifest entry, and contextual _Button\ sub-themes (e.g. \OnboardingSuccessCardPrimary_Button, \OnboardingSuccessCardSecondary_Button).
  • Primary buttons and buttons with an explicit \ heme\ prop route through \ButtonFrame\ (entering _Button\ sub-themes), while standard non-primary variants (\secondary, \outline, \ghost, \pill, \ ext, \list) route through a shared ambient-theme frame that preserves the \is_Button\ class marker without inheriting \light_Button's white-on-primary palette.
  • Verified with \pnpm --filter @goodwidget/ui lint\ (0 errors) and \pnpm --filter @goodwidget/ui --filter @goodwidget/embed --filter @goodwidget/governance-widget build.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Button variant changes replace the DOM node and lose keyboard focus, while non-primary buttons bypass existing theme overrides for borders and interactive backgrounds.

2 open issues
1 resolved since last review

Review effort: Balanced

Comment thread packages/ui/src/components/Button.tsx Resolved
Comment thread packages/ui/src/components/Button.tsx Resolved
…text (GoodDollar#303)

Signed-off-by: deamybro <193015196+deamybro@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 6, 2026 12:13
@deamybro

deamybro commented Dec 6, 2026 •

Copy link
Copy Markdown
Author

Addressed both Copilot review findings in commit d6fdc02:

  • Single ButtonFrame component identity: Button now always renders the same ButtonFrame (name: 'Button') across every variant, so toggling between primary and non-primary variants keeps the DOM node mounted and preserves keyboard focus.
  • Preserved frame-level Button overrides: Because all variants render ButtonFrame, light_Button / dark_Button frame overrides (such as borderColor and interactive backgrounds) apply consistently; outline also uses $borderColor so its border matches Button.borderColor overrides rather than light_Button.color white.
  • Readable ambient labels for non-primary variants: For non-primary variants without an explicit contextual theme prop, Button passes the enclosing theme's color via context (while preserving explicit color props on ButtonText / PillText) alongside Theme reset.
  • Verification: pnpm --filter @goodwidget/ui lint (0 errors), pnpm --filter @goodwidget/ui --filter @goodwidget/embed --filter @goodwidget/governance-widget build passed, and SSR output verified _color-0D182D on Light secondary/pill labels while preserving Button manifest registration and OnboardingSuccessCardSecondary contextual theming.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The change leaves filled pills with insufficient text contrast, breaks exported labels’ styled-component extensibility, and can make outline borders invisible in custom presets.

3 open issues
2 resolved since last review

Review effort: Balanced

backgroundColor: '$backgroundTransparent',
borderWidth: 1,
borderColor: '$color',
borderColor: '$borderColor',
Comment on lines +177 to +182
const LabelWithAmbientColor = React.forwardRef<unknown, Record<string, unknown>>(
function LabelWithAmbientColor({ color, ...props }, ref) {
const ambientColor = React.useContext(AmbientLabelColorContext)
return <StyledLabel ref={ref} color={color ?? ambientColor} {...props} />
},
)
export function Button({ variant = 'primary', children, ...props }: ButtonProps) {
const needsReset = variant !== 'primary'
const ambientTheme = useTheme()
const useAmbientChildren = variant !== 'primary' && props.theme === undefined

This branch is waiting to be deployed

1 waiting (outdated) deployment
external — b1a43a7e Waiting Nov 30, 2026 by sourcery-ai[bot] via authorize-preview #801
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.

[Patch] UI primitives: Light-theme label/colour bugs found during Storybook-to-Penpot pass

3 participants