From fafaa6de9a8cd36b7346388eeddb71b37cac50c5 Mon Sep 17 00:00:00 2001
From: Tharanishwaran <133676934+Tharanishwaran@users.noreply.github.com>
Date: Wed, 23 Oct 2024 01:19:40 +0530
Subject: [PATCH] Update index.js
Signed-off-by: Tharanishwaran <133676934+Tharanishwaran@users.noreply.github.com>
---
src/sections/Home/Partners-home/index.js | 97 +++++++++++++++---------
1 file changed, 60 insertions(+), 37 deletions(-)
diff --git a/src/sections/Home/Partners-home/index.js b/src/sections/Home/Partners-home/index.js
index f1902001e916..1fd8eb263743 100644
--- a/src/sections/Home/Partners-home/index.js
+++ b/src/sections/Home/Partners-home/index.js
@@ -1,4 +1,4 @@
-import React, { memo, Suspense, useState, useEffect } 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,8 +8,8 @@ import Slider from "react-slick";
import "slick-carousel/slick/slick.css";
import "slick-carousel/slick/slick-theme.css";
-const PartnerImage = memo(({ partner }) => (
-
+const PartnerImage = ({ partner }) => (
+
(
alt={partner.name}
width={partner.imageWidth}
height={partner.imageHeight}
- loading="eager"
+ loading="lazy"
+ onLoad={(e) => {
+ e.target.classList.add("loaded");
+ }}
/>
-));
+);
-const PartnerSlider = memo(({ settings, isVisible }) => (
-
-
- {partners.map((partner, index) => (
-
-
-
- ))}
-
-
-));
+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 [isLoaded, setIsLoaded] = useState(false);
+ const [isClient, setIsClient] = useState(false);
useEffect(() => {
- const timer = setTimeout(() => {
- setIsLoaded(true);
- }, 300);
- return () => clearTimeout(timer);
+ setIsClient(true);
}, []);
const settings = {
@@ -64,7 +86,7 @@ const Projects = () => {
speed: 500,
centerMode: true,
variableWidth: true,
- autoplay: isLoaded,
+ autoplay: isClient,
autoplaySpeed: 1500,
className: "partner-slider",
responsive: [
@@ -88,14 +110,15 @@ const Projects = () => {
-
}>
-
-
+
+ {isClient && (
+ }>
+
+
+ )}
+
);
};
-export default Projects;
\ No newline at end of file
+export default Projects;