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.
68 lines
1.7 KiB
CSS
68 lines
1.7 KiB
CSS
@import "../icon-button/IconButton.css";
|
|
/* <HeaderMenu> — the one popover every header menu (links, user, settings,
|
|
alerts) opens. Right-anchored: each trigger sits at the end of a header's
|
|
icon cluster, so a left anchor would push it off-screen. */
|
|
.header-menu {
|
|
position: relative;
|
|
display: inline-block;
|
|
}
|
|
.header-menu-popover {
|
|
position: absolute;
|
|
top: calc(100% + 0.4em);
|
|
right: 0;
|
|
z-index: var(--z-popover);
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-width: 12em;
|
|
padding: 0.4em;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius-md);
|
|
background: var(--bg-elev);
|
|
box-shadow: var(--shadow-pop);
|
|
animation: header-menu-enter 140ms ease;
|
|
}
|
|
/* A long list, such as the firing alerts: wide, and it scrolls. */
|
|
.header-menu-wide {
|
|
gap: 0.4em;
|
|
width: min(26em, calc(100vw - 2em));
|
|
max-height: 70vh;
|
|
overflow-y: auto;
|
|
}
|
|
/* Mount-triggered, not a state transition: the popover only exists in the DOM
|
|
while open, so a keyframe on entry is the right tool. */
|
|
@keyframes header-menu-enter {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(-0.25em) scale(0.98);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: none;
|
|
}
|
|
}
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.header-menu-popover {
|
|
animation: none;
|
|
}
|
|
}
|
|
:root[data-motion="reduce"] .header-menu-popover {
|
|
animation: none;
|
|
}
|
|
:root[data-motion="allow"] .header-menu-popover {
|
|
animation: header-menu-enter 140ms ease;
|
|
}
|
|
/* A row that is a link or a button. */
|
|
.header-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;
|
|
}
|
|
.header-menu-item:hover {
|
|
background: var(--bg);
|
|
}
|