agent: HeaderPill wraps Badge instead of a hand-styled pill
Badge already covers icon+label+value+onClick -- exactly HeaderPill's shape. mara, reviewing the first cut (a bespoke .header-pill matched to Badge's own CSS values): "cant we reuse the badge component". HeaderPill now renders <Badge> directly and only owns hiding at count 0 + the inbox/todos tone (amber/green on the count, same as before). Drops the now-unused .header-pill* CSS from agent.css entirely.
This commit is contained in:
parent
ad58894c25
commit
302778573d
2 changed files with 28 additions and 60 deletions
|
|
@ -319,53 +319,10 @@ h2, h3 {
|
||||||
background: color-mix(in srgb, var(--purple) 6%, transparent);
|
background: color-mix(in srgb, var(--purple) 6%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Header pill — inbox / loose-ends triggers. Compact, count-prominent.
|
/* Header pill (inbox / loose-ends triggers) — no CSS of its own any
|
||||||
Filled to match every OTHER chip in `.agent-header-pills`
|
more. `HeaderPill.tsx` renders `@hive/shared`'s `Badge` directly now
|
||||||
(StatusChips' alive/state/model/effort/pause, MetaNav's 🔗 trigger —
|
(mara: "cant we reuse the badge component") instead of a hand-styled
|
||||||
all `@hive/shared`'s `Badge`, an `.ui-badge` filled pill) — no
|
pill matched to Badge's own values; nothing left to override here. */
|
||||||
`hive-pill` on the markup any more (its bordered/transparent shape
|
|
||||||
is what made this one read as visually distinct from its neighbours;
|
|
||||||
values below are `.ui-badge`/`.ui-badge-interactive`'s own, not a
|
|
||||||
new shape). `display: inline-flex` (not Badge's default) for the
|
|
||||||
icon+label+count row this component alone needs. */
|
|
||||||
.header-pill {
|
|
||||||
background: var(--purple-dim);
|
|
||||||
border: none;
|
|
||||||
border-radius: 1em;
|
|
||||||
padding: 0.15em 0.6em;
|
|
||||||
min-height: 2.75em;
|
|
||||||
padding-inline: 0.8em;
|
|
||||||
color: var(--fg);
|
|
||||||
font-family: inherit;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.4em;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 0.15s ease, color 0.15s ease;
|
|
||||||
}
|
|
||||||
.header-pill:hover {
|
|
||||||
background: var(--border);
|
|
||||||
}
|
|
||||||
.header-pill-icon { font-size: 1.05em; line-height: 1; }
|
|
||||||
.header-pill-label { color: var(--muted); }
|
|
||||||
.header-pill-count {
|
|
||||||
background: var(--purple-dim);
|
|
||||||
color: var(--purple);
|
|
||||||
border-radius: 999px;
|
|
||||||
padding: 0 0.5em;
|
|
||||||
min-width: 1.6em;
|
|
||||||
text-align: center;
|
|
||||||
font-weight: bold;
|
|
||||||
font-variant-numeric: tabular-nums;
|
|
||||||
}
|
|
||||||
.header-pill-inbox .header-pill-count {
|
|
||||||
background: color-mix(in srgb, var(--amber) 18%, transparent);
|
|
||||||
color: var(--amber);
|
|
||||||
}
|
|
||||||
.header-pill-todos .header-pill-count {
|
|
||||||
background: color-mix(in srgb, var(--green) 18%, transparent);
|
|
||||||
color: var(--green);
|
|
||||||
}
|
|
||||||
|
|
||||||
.agent-main {
|
.agent-main {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
// <HeaderPill> — the inbox/todos flyout triggers in the header's right
|
// <HeaderPill> — the inbox/todos flyout triggers in the header's right
|
||||||
// cluster. Reuses agent.css's existing `.header-pill…` rules (loaded
|
// cluster. A thin wrapper over `@hive/shared`'s `Badge` (icon+label+
|
||||||
// globally), styled to match `@hive/shared`'s filled `Badge` pill —
|
// value+onClick already covers this shape exactly) rather than a
|
||||||
// every other chip in the same cluster is one — not the bordered
|
// bespoke pill — mara, reviewing the first cut of this (a hand-styled
|
||||||
// `.hive-pill` shape (mara: "inbox badge looks different from all the
|
// `.header-pill` matched to `Badge`'s own CSS values rather than the
|
||||||
// other ones"). Hidden (renders nothing) at count 0, matching the old
|
// component itself): "cant we reuse the badge component". Only two
|
||||||
// page's `pill.hidden = count === 0`.
|
// things this wrapper still owns: hiding at count 0 (`pill.hidden =
|
||||||
|
// count === 0` in the old page) and picking the inbox/todos tone so
|
||||||
|
// the count reads amber/green like it always has (`Badge`'s `tone`
|
||||||
|
// colours the value, which here is the count).
|
||||||
|
import { Badge, type BadgeTone } from '@hive/shared/badge.js';
|
||||||
|
|
||||||
export interface HeaderPillProps {
|
export interface HeaderPillProps {
|
||||||
kind: 'inbox' | 'todos';
|
kind: 'inbox' | 'todos';
|
||||||
icon: string;
|
icon: string;
|
||||||
|
|
@ -13,15 +18,21 @@ export interface HeaderPillProps {
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TONE: Record<HeaderPillProps['kind'], BadgeTone> = {
|
||||||
|
inbox: 'warning',
|
||||||
|
todos: 'positive',
|
||||||
|
};
|
||||||
|
|
||||||
export function HeaderPill({ kind, icon, label, count, onClick }: HeaderPillProps) {
|
export function HeaderPill({ kind, icon, label, count, onClick }: HeaderPillProps) {
|
||||||
if (count === 0) return null;
|
if (count === 0) return null;
|
||||||
return (
|
return (
|
||||||
<button type="button" class={`header-pill header-pill-${kind}`} onClick={onClick} title={`open ${label} flyout`}>
|
<Badge
|
||||||
<span class="header-pill-icon" aria-hidden="true">
|
icon={icon}
|
||||||
{icon}
|
label={label}
|
||||||
</span>
|
value={count}
|
||||||
<span class="header-pill-label">{label}</span>
|
tone={TONE[kind]}
|
||||||
<span class="header-pill-count">{count}</span>
|
onClick={onClick}
|
||||||
</button>
|
title={`open ${label} flyout`}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue