import type { FlatTemplatable } from "tempstream"; import { TempstreamJSX } from "tempstream"; import type { ComponentToHTMLArgs } from "@sealcode/jdd"; import { Component, ComponentArguments } from "@sealcode/jdd"; const component_arguments = { title: new ComponentArguments.ShortText(), content: new ComponentArguments.Structured({ text: new ComponentArguments.Markdown(), number: new ComponentArguments.ShortText().setExampleValues(["000-000-000"]), }), faq: new ComponentArguments.List( new ComponentArguments.Structured({ question: new ComponentArguments.ShortText(), answer: new ComponentArguments.Markdown(), }) ), button: new ComponentArguments.Structured({ buttonText: new ComponentArguments.ShortText().setExampleValues([""]), buttonLink: new ComponentArguments.ShortText().setExampleValues([""]), }), } as const; export class FaqComponent extends Component { getArguments() { return component_arguments; } toHTML({ args: { title, content, faq, button }, jdd_context: { render_markdown, language }, }: ComponentToHTMLArgs): FlatTemplatable { const buttonText = button.buttonText.toUpperCase(); return (
{title}
{render_markdown(language, content.text)}{" "} {content.number}
{faq.map((element, index) => (
{element.question}

{render_markdown(language, element.answer)}

))}
{button.buttonText === "" ? null : ( {buttonText} )}
); } }