From f5fc4d01591ab472e71be764eca2fce40c68cc45 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Tue, 1 Sep 2026 15:01:46 +0200 Subject: [PATCH] Add icons to the buttons jdd component --- src/back/jdd-components/buttons/buttons.jdd.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/back/jdd-components/buttons/buttons.jdd.tsx b/src/back/jdd-components/buttons/buttons.jdd.tsx index 06c9378..4febf39 100644 --- a/src/back/jdd-components/buttons/buttons.jdd.tsx +++ b/src/back/jdd-components/buttons/buttons.jdd.tsx @@ -2,6 +2,7 @@ import { TempstreamJSX } from "tempstream"; import type { ComponentToHTMLArgs } from "@sealcode/jdd"; import { Component, ComponentArguments, insert_nbsp } from "@sealcode/jdd"; import { button, button_variants } from "src/back/elements/button.js"; +import { getAllIconNames } from "src/back/icons.js"; const component_arguments = { mode: new ComponentArguments.Enum(["column", "row"]), @@ -12,6 +13,10 @@ const component_arguments = { buttons: new ComponentArguments.List( new ComponentArguments.Structured({ variant: new ComponentArguments.Enum(button_variants), + icon: new ComponentArguments.Enum(async () => [ + "none", + ...(await getAllIconNames()), + ]).setDefaultValue("none"), text: new ComponentArguments.ShortText(), href: new ComponentArguments.ShortText(), size: new ComponentArguments.Enum([ @@ -47,6 +52,7 @@ export class Buttons extends Component { {buttons.map((b) => button({ ...b, + icon: b.icon == "none" ? undefined : b.icon, text: insert_nbsp(b.text), classes: [`button--size-${b.size}`], })