Watch
0
0
Fork
You've already forked hyperhive
0

fixup! swarm-ui: shared Hint, ActionRow, Toolbar, EmptyState, ExternalLink and ExpandableCard replace per-page copies

This commit is contained in:
iris 2026-11-06 18:04:55 +01:00 • committed by mara
commit 53ccbcb4b3
5 changed files with 5 additions and 33 deletions

View file

@ -20,15 +20,6 @@
color: var(--fg); color: var(--fg);
border: 1px solid var(--border); border: 1px solid var(--border);
} }
/* `plain`: text only, no box, for a control that reads as a link in a row of
text (it keeps the touch-target height). */
.ui-button-plain {
background: none;
color: inherit;
border: 0;
padding: 0;
text-align: left;
}
.ui-button:disabled { .ui-button:disabled {
opacity: 0.6; opacity: 0.6;
cursor: default; cursor: default;

View file

@ -7,7 +7,7 @@
import type { ComponentChildren } from "preact"; import type { ComponentChildren } from "preact";
import "./Button.css"; import "./Button.css";
export type ButtonVariant = "primary" | "default" | "plain"; export type ButtonVariant = "primary" | "default";
export function Button({ export function Button({
variant = "default", variant = "default",

View file

@ -5,23 +5,15 @@ import type { ComponentChildren } from "preact";
export function ExternalLink({ export function ExternalLink({
href, href,
title,
class: extraClass, class: extraClass,
children, children,
}: { }: {
href: string; href: string;
title?: string;
class?: string; class?: string;
children: ComponentChildren; children: ComponentChildren;
}) { }) {
return ( return (
<a <a href={href} target="_blank" rel="noopener noreferrer" class={extraClass}>
href={href}
target="_blank"
rel="noopener noreferrer"
title={title}
class={extraClass}
>
{children} {children}
</a> </a>
); );

View file

@ -6,6 +6,3 @@
gap: 0.5em 0.75em; gap: 0.5em 0.75em;
margin-block-end: 0.5em; margin-block-end: 0.5em;
} }
.ui-toolbar-start {
justify-content: flex-start;
}

View file

@ -1,24 +1,16 @@
// <Toolbar> — the bar above a list or a card: filters, a count, the refresh // <Toolbar> — the bar above a list or a card: filters, a count, the refresh
// picker. Items sit on one line and wrap when narrow, aligned to the end by // picker. Items sit on one line and wrap when narrow, aligned to the end
// default (where the refresh picker sits on every page that has one). // (where the refresh picker sits on every page that has one).
import type { ComponentChildren } from "preact"; import type { ComponentChildren } from "preact";
import "./Toolbar.css"; import "./Toolbar.css";
export function Toolbar({ export function Toolbar({
justify = "end",
class: extraClass, class: extraClass,
children, children,
}: { }: {
justify?: "start" | "end";
class?: string; class?: string;
children: ComponentChildren; children: ComponentChildren;
}) { }) {
const classes = [ const classes = ["ui-toolbar", extraClass].filter(Boolean).join(" ");
"ui-toolbar",
justify === "start" && "ui-toolbar-start",
extraClass,
]
.filter(Boolean)
.join(" ");
return <div class={classes}>{children}</div>; return <div class={classes}>{children}</div>;
} }