Convert CSS variables to Tailwind 4 theme variables#432
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe changes implement a systematic refactor of CSS custom property naming conventions and Tailwind styling patterns. All CSS theme variables are renamed from ChangesCSS Theme Variable and Tailwind Token Refactor
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Hello,
when scaffolding a router project, the generated React app uses JSX with the older arbitrary value syntax of Tailwind for CSS variables in the templates. Tailwind 4 provides a simpler approach via theme variables defined in
@theme, which can also be used directly in JSX when correctly namespaced (e.g.color-for colours,spacing-for margin and padding etc.). This approach is more concise and looks arguable cleaner.To enable this, the colour variables in
styles.css.ejswere moved from:rootinto the@themeblock and prefixed with--color-(e.g.--sea-ink→--color-sea-ink), so Tailwind 4 picks them up as utility classes. The dark-mode overrides (:root[data-theme="dark"]and@media (prefers-color-scheme: dark)) and allvar(--…)references in the file were updated to match.After the renaming, the following classes in the markup were updated:
border-[var(--line)]→border-linetext-[var(--sea-ink)]→text-sea-inktext-[var(--sea-ink-soft)]→text-sea-ink-softbg-[var(--header-bg)]→bg-header-bgborder-[var(--chip-line)]→border-chip-linebg-[var(--chip-bg)]→bg-chip-bghover:bg-[var(--link-bg-hover)]→hover:bg-link-bg-hovertext-[var(--lagoon-deep)]→text-lagoon-deepCheers
Summary by CodeRabbit
Summary by CodeRabbit
--color-*scheme, improving consistency across light/dark styling and component visuals.