ÿØÿà JPEG ÿþ;
| Server IP : 68.65.120.201 / Your IP : 216.73.216.126 Web Server : LiteSpeed System : Linux server179.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64 User : taxhyuvu ( 2294) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/./taxhyuvu/nodevenv/public_html/dp_taxhelplines/14/lib/node_modules/swiper/react/ |
Upload File : |
import React from 'react';
import Swiper from 'swiper';
function calcLoopedSlides(slides, swiperParams) {
let slidesPerViewParams = swiperParams.slidesPerView;
if (swiperParams.breakpoints) {
const breakpoint = Swiper.prototype.getBreakpoint(swiperParams.breakpoints);
const breakpointOnlyParams = breakpoint in swiperParams.breakpoints ? swiperParams.breakpoints[breakpoint] : undefined;
if (breakpointOnlyParams && breakpointOnlyParams.slidesPerView) {
slidesPerViewParams = breakpointOnlyParams.slidesPerView;
}
}
let loopedSlides = Math.ceil(parseFloat(swiperParams.loopedSlides || slidesPerViewParams, 10));
loopedSlides += swiperParams.loopAdditionalSlides;
if (loopedSlides > slides.length) {
loopedSlides = slides.length;
}
return loopedSlides;
}
function renderLoop(swiper, slides, swiperParams) {
const modifiedSlides = slides.map((child, index) => {
return /*#__PURE__*/React.cloneElement(child, {
swiper,
'data-swiper-slide-index': index
});
});
function duplicateSlide(child, index, position) {
return /*#__PURE__*/React.cloneElement(child, {
key: `${child.key}-duplicate-${index}-${position}`,
className: `${child.props.className || ''} ${swiperParams.slideDuplicateClass}`
});
}
if (swiperParams.loopFillGroupWithBlank) {
const blankSlidesNum = swiperParams.slidesPerGroup - modifiedSlides.length % swiperParams.slidesPerGroup;
if (blankSlidesNum !== swiperParams.slidesPerGroup) {
for (let i = 0; i < blankSlidesNum; i += 1) {
const blankSlide = /*#__PURE__*/React.createElement("div", {
className: `${swiperParams.slideClass} ${swiperParams.slideBlankClass}`
});
modifiedSlides.push(blankSlide);
}
}
}
if (swiperParams.slidesPerView === 'auto' && !swiperParams.loopedSlides) {
swiperParams.loopedSlides = modifiedSlides.length;
}
const loopedSlides = calcLoopedSlides(modifiedSlides, swiperParams);
const prependSlides = [];
const appendSlides = [];
modifiedSlides.forEach((child, index) => {
if (index < loopedSlides) {
appendSlides.push(duplicateSlide(child, index, 'prepend'));
}
if (index < modifiedSlides.length && index >= modifiedSlides.length - loopedSlides) {
prependSlides.push(duplicateSlide(child, index, 'append'));
}
});
if (swiper) {
swiper.loopedSlides = loopedSlides;
}
return [...prependSlides, ...modifiedSlides, ...appendSlides];
}
export { calcLoopedSlides, renderLoop };