Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7188258
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/back/jdd-components/autoscrolling-images/autoscrolling-images.jdd.tsx b/src/back/jdd-components/autoscrolling-images/autoscrolling-images.jdd.tsx
index 4dac744..70c8331 100644
--- a/src/back/jdd-components/autoscrolling-images/autoscrolling-images.jdd.tsx
+++ b/src/back/jdd-components/autoscrolling-images/autoscrolling-images.jdd.tsx
@@ -1,166 +1,167 @@
import type { FlatTemplatable } from "tempstream";
import { TempstreamJSX } from "tempstream";
import type {
ExtractStructuredComponentArgumentsParsed,
JDDContext,
} 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<typeof component_arguments> {
getArguments() {
return component_arguments;
}
toHTML(
{
title,
interval,
imagesPerPage,
images,
}: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>,
{ render_image }: JDDContext
): FlatTemplatable {
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 (
<div
class="autoscrolling-images"
data-controller="autoscrolling-images"
data-autoscrolling-images-interval={interval}
>
<style>
{parsedImagesArray
.map(
(_, pageIndex) =>
`#${radioButtonIdPrefix}-autoscrolling-images__radio-${pageIndex}:checked ~ .autoscrolling-images__imgs-carousel > .autoscrolling-images__carousel {
transform: translateX(calc(${pageIndex} * (-100%)));
}
#${radioButtonIdPrefix}-autoscrolling-images__radio-${pageIndex}:checked ~ .autoscrolling-images__arrow-carousel-container
> .autoscrolling-images__arrow-carousel {
transform: translateX(calc(${pageIndex} * (-100%)));
}
#${radioButtonIdPrefix}-autoscrolling-images__radio-${pageIndex}:checked ~ .autoscrolling-images__dots-container
> label:nth-child(${pageIndex + 1}) {
background-color: #0d4d69;
}`
)
.join("\n")}
</style>
<div
class="autoscrolling-images-wrapper"
data-carousel-id-prefix={radioButtonIdPrefix}
>
<div class="autoscrolling-images__title-wrapper">
<h2 class="autoscrolling-images__title">{titleUpperCase}</h2>
</div>
<div class="autoscrolling-images__carousel-container">
{parsedImagesArray.map((_, pageIndex) => (
<input
class="autoscrolling-images__radio"
type="radio"
- name="autoscrolling-images__radio"
+ name={radioButton_name}
title={`page ${pageIndex + 1}`}
value={pageIndex}
id={`${radioButtonIdPrefix}-autoscrolling-images__radio-${pageIndex}`}
checked={pageIndex === 0}
data-action="autoscrolling-images#handleRadiochange"
/>
))}
<div class="autoscrolling-images__arrow-carousel-container">
<div class="autoscrolling-images__arrow-carousel">
{parsedImagesArray.map((_, pageIndex) => (
<div class="autoscrolling-images__arrow-container">
<label
for={`${radioButtonIdPrefix}-autoscrolling-images__radio-${
pageIndex == 0
? parsedImagesArray.length - 1
: pageIndex - 1
}`}
class="autoscrolling-images__arrow"
>
<img
class="autoscrolling-images__img-arrow-left"
src={arrow.url}
alt="←"
/>
</label>
<label
for={`${radioButtonIdPrefix}-autoscrolling-images__radio-${
pageIndex == parsedImagesArray.length - 1
? 0
: pageIndex + 1
}`}
class="autoscrolling-images__arrow"
>
<img src={arrow.url} alt="→" />
</label>
</div>
))}
</div>
</div>
<div class="autoscrolling-images__imgs-carousel">
<div
class="autoscrolling-images__carousel"
style={`--animation-length: ${numberOfImages}s`}
>
{parsedImagesArray.map((page) => (
<div class="autoscrolling-images__carousel-page">
{page.map((image) => (
<div class="autoscrolling-images__img-wrapper">
{render_image(image.image, {
container: {
width: 288,
height: 150,
objectFit: "contain",
},
alt: image.alt,
})}
</div>
))}
</div>
))}
</div>
</div>
<div class="autoscrolling-images__dots-container">
{parsedImagesArray.map((_, pageIndex) => (
<label
for={`${radioButtonIdPrefix}-autoscrolling-images__radio-${pageIndex}`}
class="autoscrolling-images__dots"
></label>
))}
</div>
</div>
</div>
</div>
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Jul 8, 08:05 (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
810434
Default Alt Text
(5 KB)
Attached To
Mode
rPIWO PIWO 2025
Attached
Detach File
Event Timeline
Log In to Comment