From c67813ff7b8a2ac3568e5be8041490f7efd2971c Mon Sep 17 00:00:00 2001 From: Joachim Viide Date: Mon, 5 Aug 2024 10:56:26 +0000 Subject: [PATCH] Make LinkButton available for app UIs --- .changeset/small-cherries-swim.md | 5 +++++ src/ui/experimental/LinkButton.ts | 23 +++++++++++++++++++++++ src/ui/experimental/index.ts | 1 + 3 files changed, 29 insertions(+) create mode 100644 .changeset/small-cherries-swim.md create mode 100644 src/ui/experimental/LinkButton.ts diff --git a/.changeset/small-cherries-swim.md b/.changeset/small-cherries-swim.md new file mode 100644 index 0000000..aae04fc --- /dev/null +++ b/.changeset/small-cherries-swim.md @@ -0,0 +1,5 @@ +--- +"@badrap/libapp": patch +--- + +Make LinkButton available fro app UIs diff --git a/src/ui/experimental/LinkButton.ts b/src/ui/experimental/LinkButton.ts new file mode 100644 index 0000000..d6397ff --- /dev/null +++ b/src/ui/experimental/LinkButton.ts @@ -0,0 +1,23 @@ +import { UiNode, element, Responsive } from "../internal.js"; + +type LinkButtonProps = { + href: string; + variant?: "default" | "primary" | "danger"; + size?: Responsive<"sm" | "md">; + iconSide?: "start" | "end"; + disabled?: boolean; + children?: UiNode; +} & ( + | { + icon: `material-symbols:${string}`; + iconOnly?: Responsive; + } + | { + icon?: undefined; + iconOnly?: undefined; + } +); + +export function LinkButton(props: LinkButtonProps): UiNode { + return element("ui-link-button", props); +} diff --git a/src/ui/experimental/index.ts b/src/ui/experimental/index.ts index d1a6597..004b643 100644 --- a/src/ui/experimental/index.ts +++ b/src/ui/experimental/index.ts @@ -12,6 +12,7 @@ export { Hidden } from "./Hidden.js"; export { HiddenInput } from "./HiddenInput.js"; export { Icon } from "./Icon.js"; export { Link } from "./Link.js"; +export { LinkButton } from "./LinkButton.js"; export { List } from "./List.js"; export { Redirect } from "./Redirect.js"; export { Switch } from "./Switch.js";