2020-10-14 12:15:09 +02:00
|
|
|
import {UIEventSource} from "../../Logic/UIEventSource";
|
2021-06-11 22:51:45 +02:00
|
|
|
import BaseUIElement from "../BaseUIElement";
|
2020-06-24 00:35:19 +02:00
|
|
|
|
2021-06-11 22:51:45 +02:00
|
|
|
export class SlideShow extends BaseUIElement {
|
2020-06-24 00:35:19 +02:00
|
|
|
|
|
|
|
|
2021-06-11 22:51:45 +02:00
|
|
|
private readonly _element: HTMLElement;
|
|
|
|
|
2020-06-24 00:35:19 +02:00
|
|
|
constructor(
|
2021-06-11 22:51:45 +02:00
|
|
|
embeddedElements: UIEventSource<BaseUIElement[]>) {
|
|
|
|
super()
|
|
|
|
|
|
|
|
const el = document.createElement("div")
|
|
|
|
this._element = el;
|
|
|
|
|
|
|
|
el.classList.add("slick-carousel")
|
2021-01-29 03:23:53 +01:00
|
|
|
require("slick-carousel")
|
2021-02-15 17:44:19 +01:00
|
|
|
// @ts-ignore
|
2021-06-11 22:51:45 +02:00
|
|
|
el.slick({
|
2021-02-06 00:05:38 +01:00
|
|
|
autoplay: true,
|
2021-01-29 03:23:53 +01:00
|
|
|
arrows: true,
|
|
|
|
dots: true,
|
|
|
|
lazyLoad: 'progressive',
|
|
|
|
variableWidth: true,
|
|
|
|
centerMode: true,
|
|
|
|
centerPadding: "60px",
|
2021-06-11 22:51:45 +02:00
|
|
|
adaptive: true
|
|
|
|
});
|
|
|
|
embeddedElements.addCallbackAndRun(elements => {
|
|
|
|
for (const element of elements ?? []) {
|
|
|
|
element.SetClass("slick-carousel-content")
|
|
|
|
}
|
2021-01-29 03:23:53 +01:00
|
|
|
});
|
2021-06-11 22:51:45 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
protected InnerConstructElement(): HTMLElement {
|
|
|
|
return this._element;
|
2021-01-29 03:23:53 +01:00
|
|
|
}
|
|
|
|
|
2020-09-13 03:29:44 +02:00
|
|
|
}
|