Part of #3591 (mara: "pop ups and menus appearing should animate"). Each popover mounts fresh on open ({open ? <div> : null}, not a state transition), so a keyframe animation on the popover element itself is the right tool -- same shape as Shell.css's own shell-page-enter (fade + a slight translate/scale settle), including the identical three-rule motion-guard (base rule, prefers-reduced-motion media query, data-motion=reduce/allow explicit overrides). Scope: LinksMenu, SettingsMenu, UserMenu -- the three header popovers. Not included here (posted findings on the issue instead of guessing): the refresh-interval picker's dropdown (native <select>, whose open popup is OS/browser chrome outside CSS reach in current browsers -- "not themed" is a platform limitation, not a bug in this component's own styling) and the jobs graph's node animations (JobqGraph is a @hive/shared component consumed by both swarm-ui and the per-hive dashboard, real design/implementation work on shared infra, not a same-shape mechanical extension of an existing pattern). Screenshot-verified the settled (post-animation) state renders correctly; a static screenshot cannot show an in-flight CSS animation, so this leans on exact structural parity with the already-shipped Shell.css pattern for the animation's own correctness.
87 lines
2.4 KiB
CSS
87 lines
2.4 KiB
CSS
/* <LinksMenu> — a single header icon-button + popover. Kept visually
|
|
quiet (no border/fill until interacted with) so it reads as chrome,
|
|
not another nav item. Button is sized to the same touch-target floor
|
|
as the shared `ui/` kit (2.75em ≈ 44px, WCAG 2.5.5) even though it
|
|
isn't built from that kit — a bespoke icon trigger, not a form
|
|
control, but the floor applies regardless of which component drew
|
|
it. No `margin-left: auto` here — `Shell.tsx`'s `.shell-header-actions`
|
|
wrapper owns pushing the whole action group to the right edge now
|
|
that `SettingsMenu` sits alongside this one. */
|
|
.links-menu {
|
|
position: relative;
|
|
}
|
|
.links-menu-button {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 2.75em;
|
|
height: 2.75em;
|
|
padding: 0;
|
|
border: 1px solid transparent;
|
|
border-radius: 0.4em;
|
|
background: none;
|
|
color: var(--fg);
|
|
font-size: 1em;
|
|
line-height: 1;
|
|
cursor: pointer;
|
|
}
|
|
.links-menu-button:hover,
|
|
.links-menu-button[aria-expanded='true'] {
|
|
border-color: var(--border);
|
|
background: var(--bg-elev);
|
|
}
|
|
.links-menu-popover {
|
|
position: absolute;
|
|
top: calc(100% + 0.4em);
|
|
right: 0;
|
|
z-index: 10;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-width: 10em;
|
|
padding: 0.4em;
|
|
border: 1px solid var(--border);
|
|
border-radius: 0.5em;
|
|
background: var(--bg-elev);
|
|
box-shadow: 0 0.25em 0.75em rgba(0, 0, 0, 0.3);
|
|
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: 0.35em;
|
|
color: var(--fg);
|
|
text-decoration: none;
|
|
white-space: nowrap;
|
|
}
|
|
.links-menu-item:hover {
|
|
background: var(--bg);
|
|
}
|