Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F3893840
jdd-component.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
978 B
Referenced Files
None
Subscribers
None
jdd-component.ts
View Options
import
{
toKebabCase
,
toPascalCase
}
from
"js-convert-case"
;
export
function
jddComponentTemplate
(
component_name
:
string
)
{
return
`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.Markdown(),
} as const;
export class
${
toPascalCase
(
component_name
)
}
extends Component<typeof component_arguments> {
getArguments() {
return component_arguments;
}
async toHTML({
args: { title, content},
classes,
jdd_context: { render_markdown, render_image, language },
}: ComponentToHTMLArgs<typeof component_arguments>): Promise<string> {
return (
<div class={["
${
toKebabCase
(
component_name
)
}
", ...classes]}>
<h2>{title} •
${
toPascalCase
(
component_name
)
}
</h2>
<div>{render_markdown(language, content)}</div>
</div>
);
}
}
`
;
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Mon, May 19, 00:56 (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
627499
Default Alt Text
jdd-component.ts (978 B)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment