diff --git a/src/sections/Home/Partners-home/index.js b/src/sections/Home/Partners-home/index.js index abf636babcdc..1fd8eb263743 100644 --- a/src/sections/Home/Partners-home/index.js +++ b/src/sections/Home/Partners-home/index.js @@ -1,4 +1,4 @@ -import React from "react"; +import React, { Suspense, useState, useEffect } from "react"; import { Container, Row } from "../../../reusecore/Layout"; import SectionTitle from "../../../reusecore/SectionTitle"; import PartnerItemWrapper from "./partnerSection.style"; @@ -8,27 +8,95 @@ import Slider from "react-slick"; import "slick-carousel/slick/slick.css"; import "slick-carousel/slick/slick-theme.css"; -const settings = { - initialSlide: 1, - lazyLoad: true, - arrows: false, - dots: false, - infinite: true, - speed: 500, - centerMode: true, - variableWidth: true, - autoplay: true, - autoplaySpeed: 1500, - className: "partner-slider", - responsive: [ - { - breakpoint: 1400, - settings: "unslick" - } - ] +const PartnerImage = ({ partner }) => ( +
+ {partner.name} { + e.target.classList.add("loaded"); + }} + /> +
+); + +const SliderContent = ({ settings }) => { + const [isVisible, setIsVisible] = useState(false); + + useEffect(() => { + const timer = setTimeout(() => { + setIsVisible(true); + }, 100); + return () => clearTimeout(timer); + }, []); + + return ( +
+ + {partners.map((partner, index) => ( + + + + ))} + +
+ ); }; +const SliderFallback = () => ( +
+); + const Projects = () => { + const [isClient, setIsClient] = useState(false); + + useEffect(() => { + setIsClient(true); + }, []); + + const settings = { + initialSlide: 1, + lazyLoad: false, + arrows: false, + dots: false, + infinite: true, + speed: 500, + centerMode: true, + variableWidth: true, + autoplay: isClient, + autoplaySpeed: 1500, + className: "partner-slider", + responsive: [ + { + breakpoint: 1400, + settings: "unslick" + } + ] + }; + return ( @@ -42,15 +110,13 @@ const Projects = () => { - - {partners.map((partner, index) => ( - -
- {partner.name} -
- - ))} -
+
+ {isClient && ( + }> + + + )} +
); };