Watch
0
0
Fork
You've already forked hyperhive
0

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:
iris 2026-11-20 00:22:56 +01:00 • committed by mara
commit 7efa8c8ea7
2 changed files with 95 additions and 64 deletions

View file

@ -1,3 +1,4 @@
@import "../icon-button/IconButton.css";
/* <UserMenu> (@hive/shared) — 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 —
@ -8,25 +9,16 @@
.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%;
/* The round shape and the open outline are the shared icon button's; the fill is
the accent inline on the element. */
.ui-icon-button.user-menu-button {
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);
.ui-icon-button.user-menu-button:hover,
.ui-icon-button.user-menu-button[aria-expanded="true"] {
outline: 1px solid var(--fg);
}
.user-menu-popover {
position: absolute;

View file

@ -16,6 +16,7 @@
// imports or `@import`s itself: the dashboard's JS bundle loads `.css`
// imports as text, so a component that imported it would not style there.
import { useEffect, useRef, useState } from "preact/hooks";
import { IconButton } from "../icon-button/IconButton.js";
import {
accountLinks,
initialOf,
@ -83,17 +84,15 @@ export function UserMenu({
return (
<div class="user-menu" ref={rootRef}>
<button
type="button"
<IconButton
class="user-menu-button"
style={{ background: pickAccent(label ?? "operator") }}
aria-haspopup="true"
aria-expanded={open}
aria-label={label ? `signed in as ${label}` : "account"}
label={label ? `signed in as ${label}` : "account"}
onClick={() => setOpen((v) => !v)}
expanded={open}
>
{initialOf(label)}
</button>
</IconButton>
{open ? (
<div class="user-menu-popover" role="menu">
{label ? <div class="user-menu-name">{label}</div> : null}