Add a proper title to the heading with echo element

This commit is contained in:
Kuba Orlik 2025-02-24 16:14:20 +01:00
parent 679514333e
commit f43ffa824f

View File

@ -1,5 +1,9 @@
import { TempstreamJSX } from "tempstream"; import { TempstreamJSX } from "tempstream";
import type { ComponentToHTMLArgs } from "@sealcode/jdd"; import type {
ComponentToHTMLArgs,
ExtractStructuredComponentArgumentsParsed,
JDDContext,
} from "@sealcode/jdd";
import { Component, ComponentArguments } from "@sealcode/jdd"; import { Component, ComponentArguments } from "@sealcode/jdd";
const component_arguments = { const component_arguments = {
@ -22,6 +26,13 @@ export class HeadingWithEcho extends Component<typeof component_arguments> {
return component_arguments; return component_arguments;
} }
getTitle(
_: JDDContext,
args: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>
) {
return args.title || null;
}
async toHTML({ async toHTML({
args: { title, level, font_family, blur_backdrop }, args: { title, level, font_family, blur_backdrop },
classes, classes,