PhotosSlider
An autoplaying, centered carousel of linked images in wide 1200×300 frames, with pagination dots.
import { PhotosSlider } from '@salla.sa/twilight-theme-engine/components/home';In plain words
A slideshow of wide pictures, each linking somewhere. It moves by itself, and dots under it show which slide is on screen.
Each item is a picture address and an optional link.
Signature
const PhotosSlider: React.MemoExoticComponent<(props: {
data: {
items: { id?: string | number; image?: string; url?: string; link_type?: string }[];
position?: number; // 1: part of the slider id
is_repeated?: boolean;
[key: string]: unknown;
};
}) => JSX.Element | null>Try it live
Loading images…
import { PhotosSlider } from '@salla.sa/twilight-theme-engine/components/home';
export function Promotions() {
return (
<PhotosSlider
data={{
position: 1, // part of the slider's element id: keep it unique on the page
items: [
{ image: 'https://cdn.example.com/summer.jpg', url: '/offers' },
{ image: 'https://cdn.example.com/new.jpg', url: '/latest-products' },
],
}}
/>
);
}
Example
import { PhotosSlider } from '@salla.sa/twilight-theme-engine/components/home';
const SLIDES = {
items: [
{ image: 'https://cdn.example.com/summer.webp', url: '/offers' },
{ image: 'https://cdn.example.com/new-in.webp', url: '/latest-products' },
],
};
export function Promotions() {
return <PhotosSlider data={SLIDES} />;
}
How it behaves
SallaSliderwithtype="carousel",centered,autoPlayandpagination, idphotos-<position>-slider. Each slide is an engineLink(to#withouturl) around the engineImage,object-contain, in a1200/300aspect-ratio box; the first image loads eagerly.is_repeateddoes nothing inside the component; the renderer addsrepeated-blockto the wrapper class.With no items it renders
null.
Gotchas
imageis a plain URL string here, whileSquarePhotosexpectsimage: { url, alt }. The two blocks look alike and take different shapes.The alt text is generated (
image-slider-0,image-slider-1…), not taken from the data: these images have no meaningful description for screen readers.