The links menu moves into @hive/shared and takes its links as a prop. The swarm UI feeds it /api/links as before; the dashboard feeds it stats, API docs and the swarm, and mounts it next to the profile menu in place of its own hamburger on the left. A link opens in a new tab unless its entry says it is a page of the same site.
87 lines
2.5 KiB
CSS
87 lines
2.5 KiB
CSS
/* <LinksMenu> (@hive/shared) — 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: 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-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);
|
|
}
|