Page MenuHomeSealhub

nice-box.jdd.tsx
No OneTemporary

nice-box.jdd.tsx

import { TempstreamJSX } from "tempstream";
import type {
ExtractStructuredComponentArgumentsValues,
JDDContext,
} from "@sealcode/jdd";
import { Component, ComponentArguments } from "@sealcode/jdd";
import type { Readable } from "stream";
const component_arguments = {
title: new ComponentArguments.ShortText(),
content: new ComponentArguments.Markdown(),
images: new ComponentArguments.List(
new ComponentArguments.Structured({
image: new ComponentArguments.Image(),
alt: new ComponentArguments.ShortText(),
})
),
} as const;
export class NiceBox extends Component<typeof component_arguments> {
getArguments() {
return component_arguments;
}
async toHTML(
{
title,
content,
images,
}: ExtractStructuredComponentArgumentsValues<typeof component_arguments>,
{ render_markdown, render_image }: JDDContext
): Promise<Readable> {
return (
<div class="nice-box">
<h2>{title}</h2>
<div>{render_markdown(content)}</div>
{images.map((image) =>
render_image(image.image, {
container: {
width: 200,
height: 200,
objectFit: "contain",
},
alt: image?.alt || "",
})
)}
</div>
);
}
}

File Metadata

Mime Type
text/x-java
Expires
Fri, Jan 24, 13:19 (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601600
Default Alt Text
nice-box.jdd.tsx (1 KB)

Event Timeline