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.
92 lines
2.3 KiB
CSS
92 lines
2.3 KiB
CSS
/* <UserMenu> — same header icon-button + popover chrome as
|
|
`LinksMenu`/`SettingsMenu`, except the trigger is a round, accent-
|
|
coloured initials avatar rather than a glyph-on-transparent button —
|
|
this is the "who is this" affordance, the other two are quiet chrome.
|
|
Kept as its own stylesheet for the same reason `SettingsMenu.css`
|
|
gives: three small, independently-evolving popovers that happen to
|
|
look alike today, not one component with three skins. */
|
|
.user-menu {
|
|
position: relative;
|
|
}
|
|
.user-menu-button {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 2.75em;
|
|
height: 2.75em;
|
|
padding: 0;
|
|
border: 1px solid transparent;
|
|
border-radius: 50%;
|
|
color: #fff;
|
|
font-size: 1em;
|
|
font-weight: 600;
|
|
line-height: 1;
|
|
cursor: pointer;
|
|
text-shadow: 0 0.05em 0.15em rgba(0, 0, 0, 0.35);
|
|
}
|
|
.user-menu-button:hover,
|
|
.user-menu-button[aria-expanded='true'] {
|
|
border-color: var(--fg);
|
|
}
|
|
.user-menu-popover {
|
|
position: absolute;
|
|
top: calc(100% + 0.4em);
|
|
right: 0;
|
|
z-index: 10;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-width: 12em;
|
|
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: user-menu-popover-enter 140ms ease;
|
|
}
|
|
/* Mount-triggered, same shape as `LinksMenu.css`'s own version — see
|
|
its comment for why a keyframe (not a transition) is the right tool
|
|
here. */
|
|
@keyframes user-menu-popover-enter {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(-0.25em) scale(0.98);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: none;
|
|
}
|
|
}
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.user-menu-popover {
|
|
animation: none;
|
|
}
|
|
}
|
|
:root[data-motion='reduce'] .user-menu-popover {
|
|
animation: none;
|
|
}
|
|
:root[data-motion='allow'] .user-menu-popover {
|
|
animation: user-menu-popover-enter 140ms ease;
|
|
}
|
|
.user-menu-name {
|
|
padding: 0.4em 0.6em 0.5em;
|
|
border-bottom: 1px solid var(--border);
|
|
margin-bottom: 0.3em;
|
|
color: var(--muted);
|
|
font-size: 0.85em;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
.user-menu-item {
|
|
display: flex;
|
|
align-items: center;
|
|
min-height: 2.75em;
|
|
padding: 0.4em 0.6em;
|
|
border-radius: 0.35em;
|
|
color: var(--fg);
|
|
text-decoration: none;
|
|
white-space: nowrap;
|
|
}
|
|
.user-menu-item:hover {
|
|
background: var(--bg);
|
|
}
|