Page MenuHomeSealhub

table.jdd.tsx
No OneTemporary

table.jdd.tsx

import { TempstreamJSX } from "tempstream";
import type { ComponentToHTMLArgs } from "@sealcode/jdd";
import { Component, ComponentArguments, isTableHeader } from "@sealcode/jdd";
const component_arguments = {
table: new ComponentArguments.Table(
new ComponentArguments.ShortText(),
new ComponentArguments.Structured({
content: new ComponentArguments.ShortText().setExampleValues([""]),
})
),
} as const;
export class Table extends Component<typeof component_arguments> {
getArguments() {
return component_arguments;
}
toHTML({
args: { table },
classes,
index,
}: ComponentToHTMLArgs<typeof component_arguments>) {
return (
<div class={["table", ...classes]} style={`--jdd-index: ${index}`}>
<table>
<tbody>
{table.rows.map((row) =>
isTableHeader(row) ? (
<tr>
<th
colspan={this.getArguments()
.table.getColumnsCount(table)
.toString()}
>
{row.header_content}
</th>
</tr>
) : (
<tr>
{row.cells.map(({ content }) => (
<td style>{content}</td>
))}
</tr>
)
)}
</tbody>
</table>
</div>
);
}
}

File Metadata

Mime Type
text/html
Expires
Tue, Dec 24, 14:04 (2 m, 48 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
556572
Default Alt Text
table.jdd.tsx (1 KB)

Event Timeline