import Swiper from 'swiper';
import SwiperCore, { Navigation, Pagination, Autoplay } from 'swiper/core';
SwiperCore.use([Navigation, Pagination, Autoplay]);

export default () => {
  const partnersSliders = $('.partners-swiper');

  partnersSliders.each(function() {
    const partnersSlider = $(this);
    const slidesToView = partnersSlider.data('slides-to-view');
    const autoplaySpeed = partnersSlider.data('autoplay-speed');
    const autoplay = partnersSlider.data('autoplay');

    new Swiper(partnersSlider[0], {
      modules: [Navigation, Pagination, Autoplay],
      freeMode: false,
      slidesPerView: slidesToView,
      breakpoints: {
        320: {
          slidesPerView: 2,
          spaceBetween: 40,
        },
        480: {
          slidesPerView: 3,
          spaceBetween: 40,
        },
        640: {
          slidesPerView: 4,
          spaceBetween: 40,
        },
        768: {
          slidesPerView: slidesToView,
          spaceBetween: 50,
        },
      },
      loop: true,
      speed: autoplaySpeed,
      noSwiping: true,
      allowTouchMove: false,
      disableOnInteraction: false,
      autoplay: autoplay ? { delay: 1 } : false,
    });
  });
};



