refactor(web): rail and tab bar as Tailwind utilities

Phone search mode keys on a named group, and hover is redefined to
apply on every pointer, as the board's own :hover rules always did.

Refs #280

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Miguel Palhas
2026-11-11 17:25:18 +00:00
co-authored by Claude Opus 5.5
parent db22e4a1d2
commit 288d4b26ad
3 changed files with 76 additions and 286 deletions
+52 -26
View File
@@ -158,6 +158,14 @@ function restoreFocus(target: HTMLElement | null) {
});
}
/** A rail destination: engraved mono words, an accent rule under the current one. */
const NAV_LINK =
"inline-flex items-center gap-2 min-h-control-h py-0 px-3 font-readout text-xs font-semibold uppercase tracking-label text-ink-muted no-underline border-b-2 border-b-transparent hover:text-accent-bright aria-[current=page]:text-accent aria-[current=page]:border-b-accent";
/** A tab bar destination: glyph over word, a short accent rule on top of the current one. */
const TAB =
"relative grid place-items-center content-center gap-1 text-2xs font-semibold uppercase tracking-wide text-ink-faint no-underline aria-[current=page]:text-accent aria-[current=page]:before:absolute aria-[current=page]:before:top-0 aria-[current=page]:before:inset-x-3/10 aria-[current=page]:before:h-rule aria-[current=page]:before:bg-accent";
function TabGlyph({ name }: { name: IconName }) {
return (
<span aria-hidden="true">
@@ -466,14 +474,18 @@ export function App() {
return (
<LiveContext.Provider value={live}>
<NavContext.Provider value={nav}>
<header className="rail" data-searching={flag(railSearching)}>
<div className="rail-inner">
<div className="rail-id">
<header
className="group/rail sticky top-0 z-20 pt-(--safe-top) border-b border-b-line bg-panel [box-shadow:inset_0_1px_var(--highlight)]"
data-searching={flag(railSearching)}
>
<div className="flex items-center gap-3 w-full max-w-deck h-rail-h mx-auto px-gutter">
{/* phone search mode: the field takes the rail, the identity steps aside */}
<div className="flex flex-none items-center gap-3 mr-auto group-data-searching/rail:hidden sm:mr-0 sm:group-data-searching/rail:flex">
<span className="lamp" data-state={masterState} aria-hidden="true" />
{/* §9.7: the wordmark is a link home — intercepted so it navigates
the SPA instead of reloading, but still a real anchor */}
<a
className="wordmark"
className="font-display text-xl font-bold tracking-wide leading-none text-ink no-underline hover:text-accent-bright focus-visible:text-accent-bright"
href="/"
id="wordmark"
ref={wordmark}
@@ -485,11 +497,11 @@ export function App() {
arr
</a>
</div>
<nav className="rail-nav" aria-label="destinations">
<nav className="hidden sm:flex sm:items-center sm:gap-1" aria-label="destinations">
<NavLink
destination="library"
current={destination}
className="nav-link"
className={NAV_LINK}
href="/"
onGo={go}
>
@@ -498,13 +510,13 @@ export function App() {
<NavLink
destination="queues"
current={destination}
className="nav-link"
className={NAV_LINK}
href="/queues"
onGo={go}
>
queues
<span
className="nav-count readout"
className="readout text-xs text-signal-warn"
data-role="queues-count"
hidden={badge === null}
>
@@ -514,21 +526,24 @@ export function App() {
<NavLink
destination="settings"
current={destination}
className="nav-link"
className={NAV_LINK}
href="/settings"
onGo={go}
>
settings
</NavLink>
</nav>
<div className="rail-search">
<span className="rail-search-glyph" aria-hidden="true">
<div className="relative hidden flex-1 items-center min-w-0 group-data-searching/rail:flex sm:flex sm:max-w-search sm:ml-auto">
<span
className="absolute left-3 text-ink-faint pointer-events-none"
aria-hidden="true"
>
<Icon name="search" />
</span>
<input
ref={inputRef}
id="search"
className="search-input readout"
className="readout w-full min-h-control-h py-0 px-8 text-base text-ink bg-ground border border-line rounded-panel [box-shadow:inset_0_1px_var(--lowlight)] caret-accent [transition:border-color_150ms_var(--ease-out)] placeholder:text-ink-faint placeholder:opacity-100 hover:border-line-strong focus:border-accent focus:outline-none sm:text-sm"
type="text"
spellCheck={false}
autoComplete="off"
@@ -562,12 +577,16 @@ export function App() {
}
}}
/>
<span className="search-hint readout" aria-hidden="true" hidden={inputFocused}>
<span
className="readout absolute right-3 hidden py-0 px-1 text-2xs text-ink-faint border border-line rounded-panel pointer-events-none lg:inline"
aria-hidden="true"
hidden={inputFocused}
>
/
</span>
<button
type="button"
className="control control-icon rail-search-close"
className="control control-icon flex-none ml-2 sm:hidden"
aria-label="close search"
onClick={() => {
setSearching(false);
@@ -579,55 +598,62 @@ export function App() {
</div>
<button
type="button"
className="control control-icon rail-search-open"
className="control control-icon group-data-searching/rail:hidden sm:hidden"
aria-label="search"
onClick={openSearch}
>
<Icon name="search" />
</button>
<span className="readout dim rail-version" data-testid="version">
<span className="readout dim hidden text-xs lg:inline" data-testid="version">
{version}
</span>
</div>
</header>
<nav className="tabbar" aria-label="destinations">
<NavLink destination="library" current={destination} className="tab" href="/" onGo={go}>
<nav
className="fixed inset-x-0 bottom-0 z-20 grid grid-cols-4 h-(--tabbar-space) pb-(--safe-bottom) bg-panel border-t border-t-line sm:hidden"
aria-label="destinations"
>
<NavLink destination="library" current={destination} className={TAB} href="/" onGo={go}>
<TabGlyph name="library" />
<span className="tab-label">library</span>
<span>library</span>
</NavLink>
<NavLink
destination="search"
current={destination}
className="tab"
className={TAB}
href="/search"
onGo={go}
>
<TabGlyph name="search" />
<span className="tab-label">search</span>
<span>search</span>
</NavLink>
<NavLink
destination="queues"
current={destination}
className="tab"
className={TAB}
href="/queues"
onGo={go}
>
<TabGlyph name="warning" />
<span className="tab-label">queues</span>
<span className="tab-badge readout" data-role="queues-count" hidden={badge === null}>
<span>queues</span>
<span
className="readout absolute top-1 left-11/20 min-w-badge h-badge py-0 px-1 rounded-pill text-2xs font-bold leading-(--spacing-badge) text-center text-ground bg-signal-warn"
data-role="queues-count"
hidden={badge === null}
>
{badge ?? ""}
</span>
</NavLink>
<NavLink
destination="settings"
current={destination}
className="tab"
className={TAB}
href="/settings"
onGo={go}
>
<TabGlyph name="cog" />
<span className="tab-label">settings</span>
<span>settings</span>
</NavLink>
</nav>
-259
View File
@@ -824,265 +824,6 @@ button.chip {
fill: var(--ink);
}
/* ---- the rail and the tab bar ------------------------------------------- */
.rail {
position: sticky;
top: 0;
z-index: 20;
padding-top: var(--safe-top);
border-bottom: 1px solid var(--line);
background: var(--panel);
box-shadow: inset 0 1px var(--highlight);
}
.rail-inner {
display: flex;
align-items: center;
gap: var(--space-3);
width: 100%;
max-width: 68rem;
height: var(--rail-h);
margin-inline: auto;
padding-inline: var(--gutter);
}
.rail-id {
display: flex;
flex: none;
align-items: center;
gap: var(--space-3);
margin-right: auto;
}
/* §9.7: the wordmark is a link home */
.wordmark {
font-family: var(--font-display);
font-size: var(--text-xl);
font-weight: 700;
letter-spacing: 0.1em;
line-height: 1;
color: var(--ink);
text-decoration: none;
}
.wordmark:hover,
.wordmark:focus-visible {
color: var(--accent-bright);
}
.rail-nav {
display: none;
}
.nav-link {
display: inline-flex;
align-items: center;
gap: var(--space-2);
min-height: var(--control-h);
padding: 0 var(--space-3);
font-family: var(--font-readout);
font-size: var(--text-xs);
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--ink-muted);
text-decoration: none;
border-bottom: 2px solid transparent;
}
.nav-link:hover {
color: var(--accent-bright);
}
.nav-link[aria-current="page"] {
color: var(--accent);
border-bottom-color: var(--accent);
}
/* attention: amber count on the queues destination, wherever it sits */
.nav-count {
font-size: var(--text-xs);
color: var(--signal-warn);
}
.rail-search {
position: relative;
display: none;
flex: 1;
align-items: center;
min-width: 0;
}
.rail-search-glyph {
position: absolute;
left: var(--space-3);
color: var(--ink-faint);
pointer-events: none;
}
.search-input {
width: 100%;
min-height: var(--control-h);
padding: 0 var(--space-8) 0 var(--space-8);
font-size: var(--text-base);
color: var(--ink);
background: var(--ground);
border: 1px solid var(--line);
border-radius: var(--radius);
box-shadow: inset 0 1px var(--lowlight);
caret-color: var(--accent);
transition: border-color 150ms var(--ease-out);
}
.search-input::placeholder {
color: var(--ink-faint);
opacity: 1;
}
.search-input:hover {
border-color: var(--line-strong);
}
.search-input:focus {
border-color: var(--accent);
outline: none;
}
.search-hint {
position: absolute;
right: var(--space-3);
display: none;
padding: 0 var(--space-1);
font-size: var(--text-2xs);
color: var(--ink-faint);
border: 1px solid var(--line);
border-radius: var(--radius);
pointer-events: none;
}
.rail-search-close {
flex: none;
margin-left: var(--space-2);
}
.rail-version {
display: none;
font-size: var(--text-xs);
}
.tabbar {
position: fixed;
right: 0;
bottom: 0;
left: 0;
z-index: 20;
display: grid;
grid-template-columns: repeat(4, 1fr);
height: var(--tabbar-space);
padding-bottom: var(--safe-bottom);
background: var(--panel);
border-top: 1px solid var(--line);
}
.tab {
position: relative;
display: grid;
place-items: center;
align-content: center;
gap: var(--space-1);
font-size: var(--text-2xs);
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--ink-faint);
text-decoration: none;
}
.tab[aria-current="page"] {
color: var(--accent);
}
.tab[aria-current="page"]::before {
content: "";
position: absolute;
top: 0;
left: 30%;
right: 30%;
height: 2px;
background: var(--accent);
}
.tab-badge {
position: absolute;
top: var(--space-1);
left: 55%;
min-width: 1.1rem;
height: 1.1rem;
padding: 0 var(--space-1);
border-radius: 999px;
font-size: var(--text-2xs);
font-weight: 700;
line-height: 1.1rem;
text-align: center;
color: var(--ground);
background: var(--signal-warn);
}
/* phone search mode: the field takes the rail, the identity steps aside */
.rail[data-searching] .rail-id,
.rail[data-searching] .rail-search-open {
display: none;
}
.rail[data-searching] .rail-search {
display: flex;
}
@media (min-width: 40rem) {
.tabbar,
.rail-search-close {
display: none;
}
/* biome-ignore lint/style/noDescendingSpecificity: the phone search-mode rule never applies from 40rem */
.rail-search-open {
display: none;
}
.rail-id {
margin-right: 0;
}
.rail-nav {
display: flex;
align-items: center;
gap: var(--space-1);
}
.rail-search,
.rail[data-searching] .rail-search {
display: flex;
max-width: 26rem;
margin-left: auto;
}
.rail[data-searching] .rail-id {
display: flex;
}
.search-input {
font-size: var(--text-sm);
}
}
@media (min-width: 64rem) {
.search-hint,
.rail-version {
display: inline;
}
}
/* ---- the row ------------------------------------------------------------------ */
/* lead | body | actions, then the tray full width. The body is minmax(0, 1fr):
+24 -1
View File
@@ -13,6 +13,10 @@
@import "./components.css" layer(components);
@import "tailwindcss/utilities.css" layer(utilities) source(none);
/* hover as the board always had it: on any pointer, not only where the
device reports hover — Tailwind's default would drop the tap feedback */
@custom-variant hover (&:hover);
/* utilities are generated from the app's own source only, never from scripts/ */
@source "./";
@@ -68,9 +72,14 @@
--spacing-rail-h: var(--rail-h);
--spacing-tabbar-h: var(--tabbar-h);
--spacing-gutter: var(--gutter);
/* the 2px rule under an active destination */
--spacing-rule: 2px;
/* a count badge's round */
--spacing-badge: 1.1rem;
--container-deck: var(--deck-max);
--container-measure: var(--measure);
--container-search: 26rem;
/* container query widths for @row, @cells and @wide: the row grows its
action column, the release cells line up, the detail hero widens */
--container-row: 40rem;
@@ -89,7 +98,21 @@
--font-readout: var(--font-readout);
--font-display: var(--font-display);
--radius-token: var(--radius);
--radius-panel: var(--radius);
--radius-pill: 999px;
--font-weight-semibold: 600;
--font-weight-bold: 700;
/* tracking, by how loudly a label is engraved */
--tracking-title: 0.04em;
--tracking-label: 0.08em;
--tracking-wide: 0.1em;
--tracking-engraved: 0.12em;
--leading-none: 1;
--leading-tight: 1.1;
--leading-snug: 1.2;
--ease-out: var(--ease-out);
/* the board's own breakpoints: tab bar to rail, column header, dense pointer */