Add icons to the buttons jdd component
This commit is contained in:
parent
50296818d8
commit
f5fc4d0159
@ -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<typeof component_arguments> {
|
||||
{buttons.map((b) =>
|
||||
button({
|
||||
...b,
|
||||
icon: b.icon == "none" ? undefined : b.icon,
|
||||
text: insert_nbsp(b.text),
|
||||
classes: [`button--size-${b.size}`],
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user