Page MenuHomeSealhub

map-with-pins.jdd.tsx
No OneTemporary

map-with-pins.jdd.tsx

import type { FlatTemplatable } from "tempstream";
import { TempstreamJSX } from "tempstream";
import type { ExtractStructuredComponentArgumentsParsed } from "@sealcode/jdd";
import { Component, ComponentArguments } from "@sealcode/jdd";
const coordinates = new ComponentArguments.ShortText();
coordinates.setExampleValues([
"52.39706859245613, 16.898251247012197",
"52.8, 16.6",
"52.5, 16.1",
"52.1, 16.35",
]);
const component_arguments = {
pins: new ComponentArguments.List(
new ComponentArguments.Structured({
title: new ComponentArguments.ShortText(),
address: new ComponentArguments.ShortText(),
coordinates,
button: new ComponentArguments.Structured({
text: new ComponentArguments.ShortText(),
link: new ComponentArguments.ShortText(),
}),
})
),
} as const;
export class MapWithPins extends Component<typeof component_arguments> {
getArguments() {
return component_arguments;
}
async getEarlyAssets() {
return [
{
type: "script" as const,
url: "https://unpkg.com/leaflet@1.9.4/dist/leaflet.js",
identity: "https://unpkg.com/leaflet@1.9.4/dist/leaflet.js",
integrity:
"sha512-BwHfrr4c9kmRkLw6iXFdzcdWV/PGkVgiIyIWLLlTSXzWQzxuSg4DiQUCpauz/EWjgk5TYQqX/kvn9pG1NpYfqg==",
},
{
type: "style" as const,
url: "https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",
integrity:
"sha512-Zcn6bjR/8RZbLEpLIeOwNtzREBAJnUKESxces60Mpoj+2okopSAcSUIUOseddDm0cxnGQzxIR7vJgsLZbdLE3w==",
identity: "https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",
},
];
}
toHTML({
pins,
}: ExtractStructuredComponentArgumentsParsed<
typeof component_arguments
>): FlatTemplatable {
return (
<div
class="map-with-pins"
data-controller="map-with-pins"
data-map-with-pins-pins-value={JSON.stringify(pins)
.replaceAll("\n", "\\n")
.replaceAll('"', "&quot;")}
></div>
);
}
}

File Metadata

Mime Type
text/x-java
Expires
Fri, Jul 4, 01:19 (19 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
797438
Default Alt Text
map-with-pins.jdd.tsx (1 KB)

Event Timeline