fix(core): preserve solid primary button text color on hover and extract PrimitiveButton - #5522
Open
ayushsinghbodra-jpg wants to merge 3 commits into
Open
ayushsinghbodra-jpg wants to merge 3 commits into
ayushsinghbodra-jpg wants to merge 3 commits into
Conversation
…act PrimitiveButton De-duplicate Settings and Team button wrappers into shared PrimitiveButton and apply ghost hover resets conditionally so solid primary buttons retain text-primary-foreground on hover. Closes BuilderIO#5493
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #5493.
Root Cause
Three core client files defined private
Buttonwrappers around the toolkitButtonthat forcedvariant="ghost"and unconditionally appendedhover:text-inherit:packages/core/src/client/org/TeamPage.tsx(TeamPrimitiveButton)packages/core/src/client/settings/SettingsPanel.tsx(SettingsPrimitiveButton)packages/core/src/client/settings/SecretsSection.tsx(SecretsPrimitiveButton)When reused for solid primary actions on those surfaces (
intent="primary" emphasis="solid"withbg-primary text-primary-foreground), Tailwind's:hoverpseudo-class matching causedhover:text-inheritto take precedence overtext-primary-foregroundon hover, turning white labels dark or illegible against the primary background.Changes
PrimitiveButton: De-duplicated the three wrappers into a single sharedPrimitiveButtoninpackages/core/src/client/ui/PrimitiveButton.tsxand re-exported it frompackages/core/src/client/ui/index.ts.resolvePrimitiveButtonEmphasisandisGhostEmphasissohover:bg-transparent hover:text-inheritis only applied when the resolved visual emphasis is"ghost"or"ghost-inset". Solid, outline, and other non-ghost buttons omit the hover reset entirely.TeamPage.tsx,SettingsPanel.tsx, andSecretsSection.tsxto importPrimitiveButton as Button, maintaining 100% API and prop compatibility.PrimitiveButton.spec.tsxtesting all emphasis resolution branches, solid primary buttons, ghost resets, outline buttons, and theme contrast assertions.TeamPage.spec.tsx,SecretsSection.spec.tsx, andSettingsPanel.connections.spec.tsxverifying that solid primary buttons across all three surfaces retaintext-primary-foregroundand excludehover:text-inherit.@agent-native/core.Verification
pnpm --filter @agent-native/core typecheck: 0 errorsPrimitiveButton.spec.tsx,TeamPage.spec.tsx,SecretsSection.spec.tsx, andSettingsPanel.connections.spec.tsxpassingguard-no-untracked-imports,guard-no-silent-coercion,guard-no-raw-colors,guard-no-boot-data-work,guard-external-result-contract) passing clean