import { For } from 'solid-js/web' import { ArticleCard } from './Card' import { Swiper, Navigation, Pagination } from 'swiper' import type { SwiperOptions } from 'swiper' import 'swiper/scss' import 'swiper/scss/navigation' import 'swiper/scss/pagination' import './Slider.scss' import type { Shout } from '../../graphql/types.gen' import { createEffect, createMemo, createSignal, Show } from 'solid-js' import { Icon } from '../Nav/Icon' interface SliderProps { title?: string articles: Shout[] } export default (props: SliderProps) => { let el: HTMLDivElement | undefined let pagEl: HTMLDivElement | undefined let nextEl: HTMLDivElement | undefined let prevEl: HTMLDivElement | undefined const opts: SwiperOptions = { loop: true, centeredSlides: true, slidesPerView: 1, spaceBetween: 8, modules: [Navigation, Pagination], speed: 500, navigation: { nextEl, prevEl }, pagination: { el: pagEl, type: 'bullets', clickable: true }, breakpoints: { 768: { slidesPerView: 1.66666 } } } const [swiper, setSwiper] = createSignal() createEffect(() => { if (!swiper() && !!el) { setTimeout(() => { setSwiper(new Swiper(el, opts)) }, 500) } }) const articles = createMemo(() => props.articles) return (

{props.title}

{(a: Shout) => ( )}
swiper()?.slideNext()}>
swiper()?.slidePrev()}>
) }