From 63300e5fc9c05c417a7ee8f3b162063700bddd0d Mon Sep 17 00:00:00 2001 From: "bert.hausmans" Date: Thu, 21 May 2026 00:45:08 +0200 Subject: [PATCH] style(layout): logo stays anchored on collapse + squarer corners MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refines the prior sidebar styling commit (8e166512) after manual smoke: - Brand logo + workspace avatar: rounded-xl -> rounded-lg (crisper square per design review; both stay unified at the same radius). - Logo no longer jumps on collapse. The previous code toggled `justify-between` ⇄ `justify-center` on the header row, which re-centred the logo against the parent's width — and the parent width animates from 256px to 64px over 200ms, so the logo slid from x≈112px (centred in the expanded rail) to x=16px (centred in the collapsed rail). Visible jump. Fix: the brand row is now ALWAYS `px-4` and left-aligned. The logo's horizontal offset (16px from the rail's left edge) is identical in expanded and collapsed states. Why this still looks centred when the rail collapses: rail_collapsed (64px) = logo (32px) + 2 × px-4 (2 × 16px) With those numbers aligned, a stationary left-aligned logo IS visually centred in the 64px-wide collapsed rail. The width transition then "slides the rail closed around" the anchored logo. Wordmark + Beta badge sit to the RIGHT of the logo and v-if-disappear on collapse; their absence doesn't shift the logo because they were never to its left. - Toggle chevron placement: - Expanded: collapse chevron (◀) inline at the right of the brand row, pushed by `ms-auto` (NOT by justify-between forcing the layout to recentre the logo). - Collapsed: a SECOND row below the brand row holds a centred expand chevron (▶) button. Replaces the prior tucked-chip that overlapped the logo. No overlap, no overhang needed against the aside's `overflow-hidden`. - WorkspaceSwitcher trigger: same anchor-on-the-left treatment applied. The `justify-center` switch on collapse is gone (it caused an identical avatar slide). Wrapper padding `p-[10px]` -> `p-2` so the avatar's left offset (wrapper 8 + trigger 8 = 16px) matches the SidebarHeader logo (px-4 = 16px) — the brand square and the workspace square are now vertically aligned in the collapsed rail. Desktop only. Mobile drawer chrome tracked separately as MOBILE-SHELL-PARITY. Tests adapted: - WorkspaceSwitcher.spec.ts: trigger-rounded assertion bumped rounded-xl -> rounded-lg; +1 spec locks "trigger never carries justify-center" (avatar-anchored invariant). - SidebarHeader.spec.ts: collapsed-behaviour spec rewritten — was asserting `justify-center`, now asserts the row carries `px-4` WITHOUT either justify-center OR justify-between (the actual anchor contract); +1 spec confirms the expand chevron lives in a SIBLING row of the brand mark (no overlap). Suite delta: 561 -> 563 (+2). vue-tsc clean. Scoped ESLint clean (0 errors, pre-existing warnings only). Manual smoke pending Bert: collapse/expand slowly and watch the logo — must NOT move horizontally. Confirm rounded-lg looks crisp (not pebble-soft). Confirm expand chevron sits in its own row below the logo, no overlap. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../components-v2/layout/SidebarHeader.vue | 130 +++++++++++------- .../layout/WorkspaceSwitcher.vue | 29 ++-- .../layout/__tests__/SidebarHeader.spec.ts | 46 +++++-- .../__tests__/WorkspaceSwitcher.spec.ts | 14 +- 4 files changed, 142 insertions(+), 77 deletions(-) diff --git a/apps/app/src/components-v2/layout/SidebarHeader.vue b/apps/app/src/components-v2/layout/SidebarHeader.vue index df6a0420..e4662f35 100644 --- a/apps/app/src/components-v2/layout/SidebarHeader.vue +++ b/apps/app/src/components-v2/layout/SidebarHeader.vue @@ -12,21 +12,39 @@ * - Desktop (>=lg): toggle the persistent sidebar between expanded/collapsed * → call toggleSidebar(). * - * Plan 2.5 P6-followup-styling: the collapse-toggle is decoupled from the - * brand group so the logo stays centered in the collapsed rail. - * - Expanded: justify-between row — [brand group] [collapse chevron]. - * - Collapsed: justify-center row — [logo only], with the expand chevron - * as a small floating circle absolute-positioned at the rail's right - * edge (tucked over the logo's right side with a solid background - * so the visual reads as an intentional chip, not an overlap). The - * aside's `overflow-hidden` (intentional, for the width transition) - * prevents true overhang past the rail edge — the tucked pattern is - * the visual compromise that keeps the affordance discoverable. + * Plan 2.5 P6-styling-fix: the brand logo must NOT move horizontally on + * collapse. Prior versions toggled `justify-between` ⇄ `justify-center` + * which re-centred the logo against the parent's width — and the parent + * width animates over 200ms, so the logo slid from x≈112px (centred in + * the 256px-wide expanded rail) to x=16px (centred in the 64px-wide + * collapsed rail). Visible jump. * - * The logo square shares its size + radius with WorkspaceSwitcher's - * avatar square (h-8 w-8 rounded-xl) so the collapsed rail reads as - * symmetric: brand-square at top, workspace-square at bottom, bracketing - * the nav icons. + * Fix: the header row is ALWAYS left-aligned with constant `px-4` + * (16px) horizontal padding. The logo sits flush against the left + * padding in both states. The "centering equation" is what makes the + * collapsed rail still look centred: + * + * rail_collapsed (64px) = logo (32px) + 2 × px-4 (2 × 16px) + * + * With those numbers aligned, a stationary left-aligned logo IS + * visually centred in the collapsed rail. The width animation then + * "slides the rail closed around" the anchored logo — exactly what + * we want. Wordmark + Beta badge sit to the RIGHT of the logo and + * disappear via v-if on collapse; their absence doesn't shift the + * logo because they were never to its left. + * + * Toggle chevron placement also changes shape based on state: + * - Expanded: collapse chevron (◀) sits inline on the right of the + * brand row, pushed there by `ms-auto`. With wordmark + badge + * present, this is the rightmost element in the row. + * - Collapsed: a SECOND row below the brand row holds a centred + * expand chevron (▶) button. This avoids the previous tucked-chip + * overlap and respects the aside's `overflow-hidden`. The second + * row only renders when collapsed. + * + * The logo + workspace avatar (WorkspaceSwitcher) share size + radius + * (h-8 w-8 rounded-lg) so the collapsed rail reads as symmetric: + * brand square at the top, workspace square at the bottom. * *