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

@ -0,0 +1,24 @@
/* <IconButton> (@hive/shared): a 2.75em circle, the touch-target floor, with no
fill until hovered or open. Open: the raised fill and a purple outline. */
.ui-icon-button {
display: flex;
align-items: center;
justify-content: center;
width: 2.75em;
height: 2.75em;
padding: 0;
border: 0;
border-radius: 50%;
background: none;
color: var(--fg);
font-size: 1em;
line-height: 1;
cursor: pointer;
}
.ui-icon-button:hover {
background: var(--border);
}
.ui-icon-button[aria-expanded="true"] {
background: var(--bg-elev);
outline: 1px solid var(--purple);
}

View file

@ -0,0 +1,40 @@
// <IconButton> — the round, icon-only button of a page header: the settings
// gear, the links glyph and the account avatar are all one. It is a 2.75em
// circle (the touch-target floor) with no fill until hovered or open. It
// carries no CSS import: the pages link `icon-button.css` (the stylesheets of
// the menus built on it `@import` it), as for `LinksMenu`.
import type { ComponentChildren } from "preact";
export function IconButton({
label,
onClick,
expanded,
class: className,
style,
children,
}: {
/** What the button does, as its accessible name and its tooltip. */
label: string;
onClick: () => void;
/** Whether the popover it opens is open. */
expanded: boolean;
/** Extra classes, for the avatar's colour. */
class?: string;
style?: Record<string, string>;
/** The glyph. */
children: ComponentChildren;
}) {
return (
<button
type="button"
class={"ui-icon-button" + (className ? " " + className : "")}
style={style}
aria-expanded={expanded}
aria-label={label}
title={label}
onClick={onClick}
>
{children}
</button>
);
}