Skip to content

refactor(ui): adopt shadcn theme vars and utility shorthand#17

Merged
rivodotlove merged 2 commits into
mainfrom
refactor/theme-css-vars
Jun 2, 2026
Merged

refactor(ui): adopt shadcn theme vars and utility shorthand#17
rivodotlove merged 2 commits into
mainfrom
refactor/theme-css-vars

Conversation

@rivodotlove

@rivodotlove rivodotlove commented Jun 2, 2026

Copy link
Copy Markdown
Owner

What

  • Replace the devbox theme palette in index.css with the shadcn variable convention (--background, --foreground, --sidebar, --sidebar-foreground, --primary, ...), exposed to Tailwind via @theme inline.
  • Update every component to the new var names. Old highlight var --accent (blue) maps to --primary (brand green); the new --accent is a muted surface, so a literal rename would have rendered highlights gray.
  • Rewrite arbitrary class syntax (bg-(--sidebar), text-(--foreground), border-(--border)) to the registered utility shorthand (bg-sidebar, text-foreground, border-border).
  • Restyle the command palette to match the original look on the shared/ui primitives.

Why

Aligns the codebase with the shadcn/ui token system so primitives and utilities resolve against a single, conventional set of theme variables.

Verification

  • vp check — formatting, lint, and type checks pass (0 errors, 54 files).
  • Re-grepped src for the old var names — zero remaining references.

Note: unrelated pre-existing .github/workflows/*.yml formatting tweaks were left out of this PR to keep it focused.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Style
    • Overhauled theming to a Tailwind-based design system with new semantic color tokens, dark variant, and updated base typography for consistent visuals across the app (sidebar, panels, tabs, command palette, shortcuts, status bar, tools, etc.)
  • Chores
    • Reduced available theme options to only "dark" and "light" (legacy theme presets removed)

Switch theme palette in index.css to the shadcn variable convention
(--background, --foreground, --sidebar, --primary, ...) and update every
component to match. Old highlight var --accent maps to --primary since the
new --accent is a muted surface. Arbitrary class syntax like
bg-(--sidebar) is rewritten to the registered utility shorthand bg-sidebar
now that the vars are exposed via @theme inline.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rivodotlove rivodotlove self-assigned this Jun 2, 2026
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 10518e7f-121d-4cb1-a3fa-3fd583be13b8

📥 Commits

Reviewing files that changed from the base of the PR and between b2841c6 and 262558b.

📒 Files selected for processing (9)
  • src/app/shell/shell-icon-button.tsx
  • src/app/shell/shortcuts-cheatsheet.tsx
  • src/app/shell/tab-item.tsx
  • src/index.css
  • src/modules/base64/ui/base64-mode-button.tsx
  • src/modules/base64/ui/base64-tool.tsx
  • src/shared/lib/themes/index.ts
  • src/shared/ui/command.tsx
  • src/shared/ui/dialog.tsx

📝 Walkthrough

Walkthrough

Replaces CSS-variable-based styling with Tailwind design tokens: adds dark/light oklch palettes and Tailwind token mappings in src/index.css, and updates component classNames across the shell, interactive UI, tool host, shared primitives, and content modules to use the new tokens.

Changes

Theme System and Component Styling

Layer / File(s) Summary
Tailwind theme foundation and base styling
src/index.css
Introduces dark and light oklch color palettes, maps them to CSS variables, integrates with Tailwind via @theme inline, and establishes base layer border/outline utilities and body typography.
Shell layout framework
src/app/shell/app-shell.tsx, src/app/shell/tab-bar.tsx, src/app/shell/status-bar.tsx, src/app/shell/tab-item.tsx, src/app/shell/sidebar.tsx
Updates the resizable sidebar Panel and resize handle, top-level Flex containers, tab items, and status bar to use border-border, bg-sidebar, text-sidebar-foreground, and bg-primary for active indicators.
Interactive shell components
src/app/shell/command-palette.tsx, src/app/shell/shortcuts-cheatsheet.tsx, src/app/shell/sidebar-tool-link.tsx, src/app/shell/category-section.tsx, src/app/shell/shell-icon-button.tsx
Refactors command palette header and rows, shortcuts kbd/header styles, sidebar tool link base/active states, category trigger text, and shell icon button classes to use tokenized utilities (text-sidebar-foreground, text-primary, bg-muted, etc.).
Tool host rendering states
src/app/tool-host/tool-loading.tsx, src/app/tool-host/tool-placeholder.tsx, src/app/tool-host/unknown-tool.tsx
Updates loading fallback, placeholder UI, and unknown-tool empty-state to tokenized text/background classes.
Content tools and welcome screen
src/modules/base64/ui/base64-tool.tsx, src/modules/base64/ui/base64-mode-button.tsx, src/routes/index.tsx
Updates Base64 mode button, headers, textarea borders and focus-visible states; welcome screen typography now uses text-sidebar-foreground/text-foreground.
Shared UI primitives
src/shared/ui/command.tsx, src/shared/ui/dialog.tsx
Replaces CSS-variable-based color classes with text-foreground, text-sidebar-foreground, border-border, and bg-background in command inputs/items and dialog content.
Theme type change
src/shared/lib/themes/index.ts
Narrows ThemeId to `"dark"

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • rivodotlove/devbox#12: Earlier Tailwind/theme token refactor touching many of the same shell, tool-host, and shared UI components.

Poem

🐰 I hopped from vars to token light,

trading --fg for classes bright,
Dark and light in oklch tune,
Borders hum and components bloom,
A rabbit stamps—design's in sight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: migrating from devbox theme variables to shadcn theme variables and using Tailwind utility shorthand instead of arbitrary CSS variable syntax.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/theme-css-vars

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 2, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
devbox 262558b Commit Preview URL

Branch Preview URL
Jun 02 2026, 04:39 PM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/modules/base64/ui/base64-tool.tsx (1)

55-55: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix legacy CSS var utility syntax in Base64 output label (and complete the refactor repo-wide)

  • src/modules/base64/ui/base64-tool.tsx still uses text-(--sidebar-fg) for the output label; this should be updated to text-sidebar-foreground.
  • Legacy text-(--*) / bg-(--*) patterns still remain elsewhere in src/ (e.g., src/shared/ui/command.tsx, src/modules/base64/ui/base64-mode-button.tsx, src/app/shell/shortcuts-cheatsheet.tsx, src/app/shell/shell-icon-button.tsx, src/app/shell/tab-item.tsx), so styling will break if the old CSS variables are removed.
🔧 Proposed fix
           <Typography
             variant="span"
-            className="mb-1 text-xs font-semibold uppercase tracking-wider text-(--sidebar-fg)"
+            className="mb-1 text-xs font-semibold uppercase tracking-wider text-sidebar-foreground"
           >
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/modules/base64/ui/base64-tool.tsx` at line 55, Replace the legacy utility
text-(--sidebar-fg) in the Base64 output label with the new token name
text-sidebar-foreground (update the className in the Base64 tool component), and
perform a repo-wide search-and-replace for patterns like text-(--*) and bg-(--*)
to the new Tailwind-like utility names used across the codebase; specifically
update the occurrences in Base64ModeButton (base64-mode-button.tsx), shared
Command component (command.tsx), ShortcutsCheatsheet (shortcuts-cheatsheet.tsx),
ShellIconButton (shell-icon-button.tsx), and TabItem (tab-item.tsx) to their
corresponding new tokens so styling continues to work after removing legacy CSS
variables.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/shell/shortcuts-cheatsheet.tsx`:
- Around line 17-18: The DialogTitle and DialogClose still use the old
parentheses CSS variable syntax (text-(--fg), text-(--sidebar-fg),
hover:text-(--fg)); update these to the Tailwind-compatible variable syntax used
elsewhere by replacing those tokens with text-[var(--fg)],
text-[var(--sidebar-fg)] and hover:text-[var(--fg)] respectively so DialogTitle
and DialogClose use the new utility classes.

In `@src/app/shell/tab-item.tsx`:
- Line 24: The active tab class uses an incorrect utility "bg-(--bg)"; update
the conditional in the TabItem component (the isActive conditional in
src/app/shell/tab-item.tsx) to use the semantic utility "bg-background" instead
of "bg-(--bg)" so active tabs use the project's standard background variable
(leave the hover class unchanged).

In `@src/index.css`:
- Line 3: The custom Tailwind variant "dark" currently uses the selector
(&:is(.dark *)) which targets a .dark class but your app toggles dark mode via
the root attribute data-theme="dark"; update the variant selector to target that
attribute (replace .dark with [data-theme="dark"]) so dark: utilities activate
(e.g., change the `@custom-variant` dark declaration in src/index.css to use
(&:is([data-theme="dark"] *)); and then verify components using dark: prefixes
such as button.tsx respond).

---

Outside diff comments:
In `@src/modules/base64/ui/base64-tool.tsx`:
- Line 55: Replace the legacy utility text-(--sidebar-fg) in the Base64 output
label with the new token name text-sidebar-foreground (update the className in
the Base64 tool component), and perform a repo-wide search-and-replace for
patterns like text-(--*) and bg-(--*) to the new Tailwind-like utility names
used across the codebase; specifically update the occurrences in
Base64ModeButton (base64-mode-button.tsx), shared Command component
(command.tsx), ShortcutsCheatsheet (shortcuts-cheatsheet.tsx), ShellIconButton
(shell-icon-button.tsx), and TabItem (tab-item.tsx) to their corresponding new
tokens so styling continues to work after removing legacy CSS variables.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 21719805-2192-4a4b-aebb-cdee236c7c44

📥 Commits

Reviewing files that changed from the base of the PR and between 19c7f62 and b2841c6.

📒 Files selected for processing (15)
  • src/app/shell/app-shell.tsx
  • src/app/shell/category-section.tsx
  • src/app/shell/command-palette.tsx
  • src/app/shell/shortcuts-cheatsheet.tsx
  • src/app/shell/sidebar-tool-link.tsx
  • src/app/shell/sidebar.tsx
  • src/app/shell/status-bar.tsx
  • src/app/shell/tab-bar.tsx
  • src/app/shell/tab-item.tsx
  • src/app/tool-host/tool-loading.tsx
  • src/app/tool-host/tool-placeholder.tsx
  • src/app/tool-host/unknown-tool.tsx
  • src/index.css
  • src/modules/base64/ui/base64-tool.tsx
  • src/routes/index.tsx

Comment thread src/app/shell/shortcuts-cheatsheet.tsx Outdated
Comment thread src/app/shell/tab-item.tsx Outdated
Comment thread src/index.css Outdated
Convert the remaining old-var references (--bg/--fg/--sidebar-fg/--accent)
that the first pass missed across command, dialog, shortcuts-cheatsheet,
tab-item, shell-icon-button and the base64 module, so no className resolves
against an undefined custom property. Trim the theme registry to the two
palettes index.css actually defines (dark, light) and point the `dark`
custom-variant at [data-theme="dark"] to match how themes are applied.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rivodotlove rivodotlove merged commit 22f06f7 into main Jun 2, 2026
2 of 3 checks passed
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.

1 participant