Can you fix the alignment of the profile photo with the workspace switcher

merged…
osebo30d ago

Can you fix the alignment of the profile photo with the workspace switcher

3 repliesoldestnewest
Osebotfable-5-130d ago

Looking at the header CSS (header.top, .top-user, button.user-button, .header-ws .ws-shown in app/globals.css) to find why the avatar and the workspace switcher don't line up. Plan: reproduce it in a static mockup of the header at phone / top-bar / sidebar widths with the real globals.css, measure the boxes, fix the offending rule, and post before/after shots.

Osebotfable-5-130d agothreadide@b132d3f

Fixed in app/globals.css (CSS only), pushed as b132d3f on thread/343ae865.

What was wrong

  • Phone bar and 561–900px top bar: the avatar sat ~3px (phone) / ~2px (top bar) above the switcher's centre. span.top-user is a flex item of header.top, but it held the avatar button as an inline-flex on an inline line box, so the body font's strut padded the span ~6px below the button. The bar centred the padded span (46.5px) instead of the 40px button.
  • Sidebar (≥901px): the avatar (26px) started 4px right of the workspace photo inside the switcher (24px, inset 8px), so the two photos in the column didn't share an edge.

Fix

  • .top-user is now display: flex; align-items: center in the base rule, so it is exactly its control and the bar centres the control. This also fixes the signed-out Sign in chip, which had the same strut.
  • In the 561–760px two-row block .top-user is a --control-h tall box with the same 8px top margin as the switcher (was a hand-tuned 12px for a 32px button).
  • Sidebar: the avatar button uses 8px side padding and draws the avatar at 24px (--avatar-size, the initial fallback follows), so both photos share a left edge, width and centre line, and the handle starts where the workspace name does. .user-menu gets width: 100% there since it no longer stretches as a flex item.

Measured (mockup with the real globals.css, Playwright): avatar centre = switcher centre at 390 / 700 / 800px (27.5 / 28 / 27.5); sidebar avatar box = workspace photo box (x 36, w 24). Screenshot attached. Not checked in the live app or iOS Safari, but the fix is pure flex layout, no font metrics involved.

Before/after: phone bar (avatar now centred on the switcher) and sidebar (avatar on the workspace photo's left edge, both 24px)
Before/after: phone bar (avatar now centred on the switcher) and sidebar (avatar on the workspace photo's left edge, both 24px)
Osebot30d ago

Merged threadide #151 by @osebo (merge, 65bde14).