Skip to content

Commit 347710a

Browse files
committed
fix(ui): stop the version badge overlapping the panel name in the header
On a narrow desktop the header row squeezed the brand box below its content width. The wordmark had no way to give ground — no min-w-0, no truncate — so instead of shrinking it overflowed its box and rendered underneath the version badge next to it. The fix is in the logo: the name now ellipses (min-w-0 + truncate) while the mark itself stays fixed. Pinning the brand with shrink-0 would also have stopped the overlap, but only by pushing the row wider than the viewport and giving the whole page a horizontal scrollbar. The version badge is decorative, so it's the first thing to go when space is tight: hidden below lg, which keeps the panel name whole rather than truncating it to make room for a badge. The nav gets min-w-0 too — a flex item's default min-width:auto floors it at its content width, so its overflow-x-auto never actually engaged.
1 parent d372e26 commit 347710a

2 files changed

Lines changed: 24 additions & 21 deletions

File tree

web/src/Dashboard.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ export function Dashboard({
8989
{/* White sticky top bar. */}
9090
<header className="sticky top-0 z-100 border-b border-brand-600/10 bg-white shadow-sm">
9191
<div className="mx-auto flex h-16 max-w-6xl items-center justify-between gap-3 px-3 sm:px-4">
92-
<div className="flex gap-2 items-center">
92+
{/* min-w-0 lets this box shrink so the row never overflows the viewport;
93+
BrandLogo ellipses instead of spilling over the badge next to it. The
94+
badge is decorative, so it's the first thing to go when space is tight —
95+
below lg the nav needs every pixel, and hiding it keeps the panel name
96+
whole instead of truncating it to make room. */}
97+
<div className="flex min-w-0 gap-2 items-center">
9398
<button
9499
className="text-gray-600 md:hidden"
95100
onClick={() => setMenuOpen(true)}
@@ -99,15 +104,17 @@ export function Dashboard({
99104
</button>
100105
<BrandLogo size={26} />
101106
{version && (
102-
<span className="rounded-full self-start accent-tint px-2 py-0.5 text-xs font-medium text-ink-muted sm:inline">
107+
<span className="hidden shrink-0 whitespace-nowrap rounded-full self-start accent-tint px-2 py-0.5 text-xs font-medium text-ink-muted lg:inline">
103108
v{version}
104109
</span>
105110
)}
106111
</div>
107112

108-
{/* Desktop nav + account. */}
109-
<div className="hidden items-center gap-8 md:flex">
110-
<nav className="no-scrollbar flex items-center gap-7 overflow-x-auto">
113+
{/* Desktop nav + account. min-w-0 is what lets the nav actually shrink —
114+
a flex item's default min-width:auto floors it at its content width, so
115+
overflow-x-auto on the nav would never engage without it. */}
116+
<div className="hidden min-w-0 items-center gap-8 md:flex">
117+
<nav className="no-scrollbar flex min-w-0 items-center gap-7 overflow-x-auto">
111118
{NAV.map((n) => (
112119
<button
113120
key={n.value}

web/src/Logo.tsx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,24 @@ export function BrandLogo({ size = 30 }: { size?: number }) {
1111
const imgSize = `${(size + 6) / 16}rem`
1212
const src = brand.has_custom_logo ? brand.logoURL : logoUrl
1313

14+
// min-w-0 + truncate: in a cramped flex row (the desktop header) the wordmark must
15+
// give way by ellipsing, not by overflowing its box — an overflowing wordmark used
16+
// to render underneath the version badge sitting next to it. The mark itself never
17+
// shrinks, so it can't be squashed out of proportion.
1418
return (
15-
<span className="inline-flex items-center gap-2.5">
19+
<span className="inline-flex min-w-0 items-center gap-2.5">
1620
<img
1721
src={src}
22+
className="shrink-0"
1823
style={{ width: imgSize, height: imgSize, objectFit: 'contain' }}
1924
alt=""
2025
/>
21-
{isDefault ? (
22-
<span
23-
className="font-extrabold leading-none tracking-tight text-accent"
24-
style={{ fontSize: `${(size * 0.72) / 16}rem` }}
25-
>
26-
РосПанель
27-
</span>
28-
) : (
29-
<span
30-
className="font-extrabold leading-none tracking-tight text-accent"
31-
style={{ fontSize: `${(size * 0.72) / 16}rem` }}
32-
>
33-
{brand.panel_name}
34-
</span>
35-
)}
26+
<span
27+
className="min-w-0 truncate font-extrabold leading-none tracking-tight text-accent"
28+
style={{ fontSize: `${(size * 0.72) / 16}rem` }}
29+
>
30+
{isDefault ? 'РосПанель' : brand.panel_name}
31+
</span>
3632
</span>
3733
)
3834
}

0 commit comments

Comments
 (0)