import { TempstreamJSX } from "tempstream"; import type { ComponentToHTMLArgs } from "@sealcode/jdd"; import { Component, ComponentArguments } from "@sealcode/jdd"; import arrow from "./autoscrolling-images-arrow.svg"; const component_arguments = { title: new ComponentArguments.ShortText(), interval: new ComponentArguments.ShortText().setExampleValues(["5"]), imagesPerPage: new ComponentArguments.ShortText().setExampleValues(["6"]), images: new ComponentArguments.List( new ComponentArguments.Structured({ image: new ComponentArguments.Image(), alt: new ComponentArguments.ShortText(), }) ), } as const; export class AutoscrollingImages extends Component { getArguments() { return component_arguments; } toHTML({ args: { title, interval, imagesPerPage, images }, jdd_context: { render_image }, }: ComponentToHTMLArgs) { const imageNumberPerPage = parseInt(imagesPerPage); const parsedImagesArray = []; for (let i = 0; i < images.length; i += imageNumberPerPage) { parsedImagesArray.push(images.slice(i, i + imageNumberPerPage)); } const radioButtonIdPrefix = "r" + Math.floor(100 + Math.random() * 900); const radioButton_name = `autoscrolling-images__radio--${radioButtonIdPrefix}`; const numberOfImages = images.length * 5; const titleUpperCase = title.toUpperCase(); return (

{titleUpperCase}

); } }