Something went wrong. Try again.
A component based functional template language
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041template Subheadline { let text = #String;
<span>{text}</span>}
template HeadlineSecondary { let class = #String? |> Base:Fn.default("");
let tag = #String? |> Base:Fn.default("h3");
let data = #Record(of: { text: if (tag == "h2") #String else "No no no ... make h2 when you want text", subheadline?: if (tag == "h2") #String });
let class = "HeadlineSecondary $(class)";
let content = <> {if (data.subheadline) <Subheadline text={data.subheadline} />} {data.text} </>;
if (tag == "h1") { <h1 class={class}>{content}</h1> } else if (tag == "h2") { <h2 class={class}>{content}</h2> } else if (tag == "h3") { <h3 class={class}>{content}</h3> } else if (tag == "h4") { <h4 class={class}>{content}</h4> } else if (tag == "h5") { <h5 class={class}>{content}</h5> } else if (tag == "h6") { <h6 class={class}>{content}</h6> } else { "INVALID TAG!" }}