import { createSignal, For, Show } from 'solid-js' import { Icon } from '../Icon' import { register } from 'swiper/element/bundle' import SwiperCore, { Manipulation, Navigation, Pagination } from 'swiper' import { SwiperRef } from './swiper' import { clsx } from 'clsx' import styles from './Swiper.module.scss' import { Shout } from '../../../graphql/types.gen' import { ArticleCard } from '../../Feed/ArticleCard' type Props = { slides: Shout[] title?: string } register() SwiperCore.use([Pagination, Navigation, Manipulation]) export const ArticleCardSwiper = (props: Props) => { const [slideIndex, setSlideIndex] = createSignal(0) const mainSwipeRef: { current: SwiperRef } = { current: null } const handleSlideChange = () => { setSlideIndex(mainSwipeRef.current.swiper.activeIndex) } return (

{props.title}

0}>
(mainSwipeRef.current = el)} centered-slides={true} thumbs-swiper={'.thumbSwiper'} observer={true} onSlideChange={handleSlideChange} space-between={26} breakpoints={{ 576: { spaceBetween: 20, slidesPerView: 1 }, 992: { spaceBetween: 52, slidesPerView: 1.5 } }} loop={true} speed={800} autoplay={{ disableOnInteraction: false, delay: 6000, pauseOnMouseEnter: true }} > {(slide, index) => ( // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore )}
mainSwipeRef.current.swiper.slidePrev()} >
mainSwipeRef.current.swiper.slideNext()} >
{/*
*/} {/* {slideIndex() + 1} / {props.slides.length}*/} {/*
*/}
) }