refactor(ui): migrate sidebar visual properties to cva variants - #403
Merged
Conversation
Migrate sidebar visual properties from hand-written .maka-* CSS rules to cva variants aligned with ui.tsx governance, and fix collapsed story rendering. - Add navRowVariants, settingsButtonVariants, rowActionVariants cva in session-list-panel.tsx (sidebarIconButtonVariants removed after main moved search/toggle to shell topbar) - Unify all sidebar UiButton to size="nav" + cva variant - Remove ~180 lines of visual CSS from sidebar.css (hover, active, focus, disabled, pending states for nav-row, settings, row-action) - Converge font sizes: 9.5/10/10.5/11/12/13/14 seven tiers to 11/13/14 - Remove uppercase/letter-spacing from group label (ineffective for Chinese), use weight-based hierarchy - Establish active-state hierarchy: nav 0.09 > list 0.07 > hover 0.06 - Fix collapsed story: .agents-sidebar[data-collapsed=true] width:0 (correct in app, breaks in story) overridden via inline <style> - Fix .maka-list-group-toggle: remove font:inherit (bug resetting weight/size to parent), add justify-content:flex-start to override UiButton justify-center - Update 2 contract tests to check cva patterns instead of CSS rules Closes #390
Astro-Han
force-pushed
the
opencode/390-sidebar-polish
branch
from
July 1, 2026 10:24
492efaf to
dde2216
Compare
6 tasks
…test - P2: add child selectors to navRowVariants for active icon (text-foreground), newTask icon (foreground-70), and count default color (foreground-40) — these were lost when CSS rules were deleted - P3a: replace settingsButtonVariants cva (no variants) with a plain const string, keeping cva only for navRowVariants/rowActionVariants that have actual tone branches - P3b: add assertion that SessionRow action buttons call rowActionVariants(), so removing the call now fails the test (verified by temporarily removing all 4 calls)
…en test - P3: remove redundant tone.default text color (already in base class) - P3: move count active background/color from CSS to navRowVariants cva - P3: row action test uses matchAll to assert all 4 buttons call rowActionVariants, not just one
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.
Summary
Migrate sidebar
SessionListPanelvisual properties from hand-written.maka-*CSS tocvavariants aligned withui.tsxgovernance, and fix the collapsed Storybook story rendering.Why
Closes #390. The sidebar carried ~180 lines of visual CSS (hover, active, focus, disabled, pending states for nav-row, settings, row-action) duplicating what
cvavariants already govern throughbuttonVariantsinui.tsx. Font sizes had drifted to seven tiers (9.5/10/10.5/11/12/13/14px) with no design intent. The collapsed story was blank because.agents-sidebar[data-collapsed="true"] { width: 0 }(correct in the app, where an outer resizable container sets width) collapsed the panel inside Storybook's 72px block container.Scope
Changed:
packages/ui/src/session-list-panel.tsx— add 3 cva variants (navRowVariants,settingsButtonVariants,rowActionVariants); unify all sidebarUiButtontosize="nav"+ cva variant.apps/desktop/src/renderer/styles/sidebar.css— remove ~180 lines of visual CSS; keep grid layout,-webkit-app-region, and stable class hooks only.apps/desktop/src/renderer/styles/onboarding.css— converge font sizes to 11/13/14px; removeuppercase/letter-spacingfrom group label; fix.maka-list-group-togglefont: inheritbug (was resetting weight/size to parent values); addjustify-content: flex-startto overrideUiButton'sjustify-center.packages/ui/stories/session-list-panel.stories.tsx— collapsed story adds inline<style>overridingwidth: 0so the 72px icon rail renders.apps/desktop/src/main/__tests__/session-row-actions-fail-soft-contract.test.ts— check cva pending state instead of CSS rule.apps/desktop/src/main/__tests__/search-modal-lifecycle-contract.test.ts— regex matchescn()className.Not included:
primitives/sidebar.tsx(740 lines, shadcn-style) remains dead code — out of scope.visibility: hiddenalready mitigates meta/unread).Verification
npm run typecheck— all workspaces pass.npm run pretest(check-console + check-a11y) — pass.session-row-actions-fail-soft,search-modal-lifecycle) — 23/23 pass.notes/screenshots/compare/.User-facing impact
No behavioral change. Visual changes are within existing story contracts:
rounded-md); original 6px/8px mix had no design intent.Reviewer notes
mainafter shell-chrome refactor moved search/toggle from sidebar header to shell topbar;sidebarIconButtonVariantswas removed as it no longer has consumers in the sidebar.<style>override is a fixture fix, not a component change — in the real app the outer resizable grid column sets width, sowidth: 0on.agents-sidebar[data-collapsed="true"]is correct.size="nav"is an empty-string variant (no size utilities) that preventsbuttonVariantsfrom injecting conflicting size classes; visual properties come entirely from the cva variant.text-sm(0.875rem) = 13.125px, not the 14px a 16px root would give.list-row-nameuses0.875remto match nav'stext-sm.