Watch
0
0
Fork
You've already forked hyperhive
0

frontend: one header menu for the links, user, settings and alerts popovers

Part of the unification order in the UI sweep issue (step c).

The four header menus each kept their own open state, dismiss hook and a copy
of the popover CSS, and the copies had drifted (offset, padding, fade-in). A
shared HeaderMenu now owns the state, the dismiss rules and the popover look;
each menu supplies its button and its rows. The settings popover moves 0.15em
lower and the settings and alerts popovers gain the fade-in.
This commit is contained in:
iris 2026-11-25 22:25:40 +01:00
commit 6f73bf0c55

View file

@ -1,63 +1,5 @@
@import "../icon-button/IconButton.css";
/* <LinksMenu> (@hive/shared) — a header icon button (the shared `IconButton`)
and its popover. No `margin-left: auto` here: the mounting page's header owns
pushing the action group to the right edge (the swarm UI's
`.shell-header-actions`, the dashboard's `.dashboard-chrome-actions`). */
.links-menu {
position: relative;
}
.links-menu-popover {
position: absolute;
top: calc(100% + 0.4em);
right: 0;
z-index: var(--z-popover);
display: flex;
flex-direction: column;
min-width: 10em;
padding: 0.4em;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--bg-elev);
box-shadow: var(--shadow-pop);
animation: links-menu-popover-enter 140ms ease;
}
/* Mount-triggered, not a state transition — the popover only exists in
the DOM while open (`{open ? <div> : null}`), so a keyframe animation
on entry is the right tool, same shape as `.shell-body`'s own
`shell-page-enter` (Shell.css) — that's the precedent every popover
in this issue's "menus should animate" ask follows. */
@keyframes links-menu-popover-enter {
from {
opacity: 0;
transform: translateY(-0.25em) scale(0.98);
}
to {
opacity: 1;
transform: none;
}
}
@media (prefers-reduced-motion: reduce) {
.links-menu-popover {
animation: none;
}
}
:root[data-motion="reduce"] .links-menu-popover {
animation: none;
}
:root[data-motion="allow"] .links-menu-popover {
animation: links-menu-popover-enter 140ms ease;
}
.links-menu-item {
display: flex;
align-items: center;
gap: 0.5em;
min-height: 2.75em;
padding: 0.4em 0.6em;
border-radius: var(--radius-sm);
color: var(--fg);
text-decoration: none;
white-space: nowrap;
}
.links-menu-item:hover {
background: var(--bg);
}
/* <LinksMenu> (@hive/shared) — a `HeaderMenu` of links; the popover and the
link row are `HeaderMenu.css`'s. No `margin-left: auto` here: the mounting
page's header owns pushing the action group to the right edge (the swarm
UI's `.shell-header-actions`, the dashboard's `.dashboard-chrome-actions`). */
@import "../header-menu/HeaderMenu.css";