frontend: one shared IconButton for the header's settings, links and account buttons
The gear was a quiet pill badge (37px tall), the links button a bordered rounded square with its own CSS, and the avatar a third copy of the same circle. They are one IconButton now: a 2.75em circle with no fill until hovered or open, then the raised fill and a purple outline. The avatar keeps its accent fill and initials and takes the shared shape. The swarm UI and the dashboard both get the shared look.
This commit is contained in:
parent
1552019580
commit
7efa8c8ea7
2 changed files with 95 additions and 64 deletions
|
|
@ -1,35 +1,11 @@
|
|||
/* <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`). */
|
||||
@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-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);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
// imports as text, so a component that imported it would not style there
|
||||
// (the same split as `UserMenu`).
|
||||
import { useEffect, useRef, useState } from "preact/hooks";
|
||||
import { IconButton } from "../icon-button/IconButton.js";
|
||||
import { LinkIcon } from "../icons.js";
|
||||
import { linkAttrs, type MenuLink } from "./links.js";
|
||||
|
||||
|
|
@ -48,17 +49,13 @@ export function LinksMenu({
|
|||
|
||||
return (
|
||||
<div class="links-menu" ref={rootRef}>
|
||||
<button
|
||||
type="button"
|
||||
class="links-menu-button"
|
||||
aria-haspopup="true"
|
||||
aria-expanded={open}
|
||||
aria-label={label}
|
||||
title={label}
|
||||
<IconButton
|
||||
label={label}
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
expanded={open}
|
||||
>
|
||||
<LinkIcon />
|
||||
</button>
|
||||
</IconButton>
|
||||
{open ? (
|
||||
<div class="links-menu-popover" role="menu">
|
||||
{links.map((link) => (
|
||||
|
|
|
|||
Loading…
Reference in a new issue