fix(web/default/wallet): make recharge preset selection visible in dark mode#4897
fix(web/default/wallet): make recharge preset selection visible in dark mode#4897xinnyu wants to merge 1 commit into
Conversation
…rk mode Selected preset buttons looked identical to unselected in dark mode: the override classes `border-foreground bg-foreground/5` carry no `dark:` variant, while the Button `outline` variant base contains `dark:border-input dark:bg-input/30`. tailwind-merge keeps both (different variants → no conflict), and in dark mode CSS specificity makes `.dark .border-input` win over `.border-foreground`, so the override is silently overridden and the bright-border/tinted-bg selection state never applies. Add explicit `dark:border-foreground dark:bg-foreground/10` to the override so tailwind-merge resolves the dark-variant conflict in favor of the override and the selected state is clearly distinguishable on both light and dark backgrounds.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe RechargeFormCard component's preset-amount button styling is updated to include dark-mode classes when a preset is selected. The selected state now applies Preset Button Dark Mode Styling
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
On the recharge page (
web/default/src/features/wallet/components/recharge-form-card.tsx), the selected preset-amount button is nearly indistinguishable from unselected buttons in dark mode — users cannot tell which amount they have chosen.Root cause
The selected-state override only sets light-mode utilities:
while
<Button variant='outline'>(web/default/src/components/ui/button.tsx) sets dark-only utilities in its base style:outline: 'border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50'tailwind-mergekeeps bothborder-foreground(no variant) anddark:border-input(dark variant) because they belong to different variant groups. At runtime, CSS specificity decides:.dark .border-input(compound selector, specificity 0,2,0) wins over.border-foreground(single class, specificity 0,1,0). Same story forbg-foreground/5vsdark:bg-input/30.Result in dark mode: selected = unselected, both rendered with the variant's
dark:border-inputborder anddark:bg-input/30background.Fix
Add
dark:variants to the override so tailwind-merge resolves the dark-variant conflict in favor of the override:After this, in dark mode the selected preset shows a bright
--foregroundborder and a 10% foreground-tint background — clearly visible against the card surface. Light mode behavior is unchanged.The bump from
/5to/10for the dark-mode background offsets the fact that--foregroundin dark mode is near-white and a 5% tint is too subtle against the dark card.Test plan
cd web/default && bun run typecheckpassescd web/default && bun run buildsucceeds (via the project'sscripts/dev-build.sh)/topupin dark mode → click a preset amount → verify bright border + visible tinted background on the selected card, and that the difference vs. unselected is clearly distinguishableSummary by CodeRabbit