import { html } from "lit"; import { msg } from "@lit/localize"; import type { BuilderComponent } from "../../types/BuilderComponent"; import { FONT_OPTIONS } from "../../builder/data/data"; const DEFAULT_FONT = "system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif"; export const LabelComponent: BuilderComponent = { type: "label", label: () => msg("Label"), group: "text", defaultData: { font: DEFAULT_FONT, }, render: (data) => { const font = data?.font ?? DEFAULT_FONT; const color = data?.color ?? "#000000"; const content = data?.content ?? msg("Label"); const fontWeight = data?.["font-weight"] ?? "normal"; const fontSize = data?.["font-size"] ?? "1em"; return html` `; }, bindings: () => [ { key: "content", label: msg("Label text"), kind: "text", target: "label", placeholder: msg("Enter label text…"), }, { key: "color", label: msg("Text color"), kind: "style", target: "label", name: "color", placeholder: "#000000", }, { key: "font-weight", label: msg("Font weight"), kind: "style", target: "h1", name: "font-weight", placeholder: `${msg("e.g.")} 400 ${msg("or")} bold`, }, { key: "font-size", label: msg("Font size"), kind: "style", target: "label", name: "font-size", placeholder: `${msg("e.g.")} 32px ${msg("or")} 2em`, } ], settings: ({ data, setData }) => { const current = (data?.font as string) ?? DEFAULT_FONT; const currentLabel = FONT_OPTIONS.find((f) => f.value === current)?.label ?? msg("Choose font"); return html`