Skip to content

Commit 7e4121e

Browse files
committed
fix(#92): header grid — right column gets priority over left's slack
The grid was `1fr auto 1fr`, which gave the left and right columns an equal share of remaining space regardless of content. On medium- sized viewports that left wide empty space on the LEFT while the RIGHT toolbar's per-page controls (selects + buttons) got clipped because their column couldn't grow past its equal share. Changed the template to: minmax(0, 1fr) auto minmax(max-content, 1fr) - LEFT → `minmax(0, 1fr)`: can absorb all slack OR shrink to 0. The chip name + breadcrumb may clip on narrow viewports. - CENTER → `auto`: the search box at its content width, unchanged. - RIGHT → `minmax(max-content, 1fr)`: its full natural width is the floor, so it never clips; beyond that it shares free space evenly with the left so the search stays visually viewport-centered when there's room. Behaviour at three sample viewport widths (HAProxy gear, full toolbar): 3000px left=1332 search=281 right=1332 → search 4px off center 1750px left=633 search=281 right=781 → right at max-content, left absorbs ~250px slack 1280px left=163 search=281 right=781 → left clips (chip+breadcrumb truncate) right stays fully visible Refs #92
1 parent 49394d7 commit 7e4121e

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

  • gearbox/internal/framework/templates/layouts

gearbox/internal/framework/templates/layouts/base.templ

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,19 +2375,16 @@ templ Header(currentPath string) {
23752375
HeaderSearch in the visual center, per-page controls on the
23762376
right. The auto-sized middle is also the viewport center. -->
23772377
<header class="fixed top-0 inset-x-0 bg-white dark:bg-slate-800 border-b border-gray-200 dark:border-slate-700 z-50">
2378-
<!-- Grid: the auto-sized center column sizes to its IDLE content
2379-
(icon + input + hint chips), giving the search bar a default
2380-
width that matches its contents. To prevent the box from
2381-
shrinking when entering palette mode, header-search.js
2382-
uses `visibility: hidden` (not display:none) on the icon
2383-
and hint chips so they keep their layout space.
2384-
On narrower viewports the chips drop out via the
2385-
`hidden lg:flex` responsive rule on #header-search-hint,
2386-
which IS a real display:none — the box then shrinks
2387-
intentionally per the user request to "shrink some as the
2388-
window gets more narrow, even if it does mean we lose some
2389-
of our helper text". -->
2390-
<div class="grid grid-cols-[1fr_auto_1fr] items-center px-3 h-[55px] gap-3">
2378+
<!-- Grid: left column absorbs all the slack (`minmax(0, 1fr)`)
2379+
so the right toolbar never has to clip while the left
2380+
side sits there with wasted empty space (issue #92
2381+
follow-up). The right column is `minmax(max-content, 1fr)`
2382+
— its full natural width is the floor, so it always fits;
2383+
beyond that it shares free space evenly with the left so
2384+
the search stays visually centered when there's room.
2385+
The auto-sized center column carries the search box and
2386+
stays at its content width across modes. -->
2387+
<div class="grid grid-cols-[minmax(0,1fr)_auto_minmax(max-content,1fr)] items-center px-3 h-[55px] gap-3">
23912388
<!-- LEFT: gearbox identity + box context.
23922389
The logo + sidebar collapse toggle live here now (they
23932390
used to be in the sidebar's own header bar). Keeps the

0 commit comments

Comments
 (0)