"use client" import React, { useState, useEffect, useRef } from 'react'; import Image from 'next/image'; const ClientsSection = () => { const [translateX, setTranslateX] = useState(0); const [isTransitioning, setIsTransitioning] = useState(true); const containerRef = useRef(null); const clients = [ { name: "Ashoka University", logo: "/images/client/ashoka.png" }, { name: "BRIC", logo: "/images/client/BRIC.png" }, { name: "CSIR", logo: "/images/client/csir.png" }, { name: "DRDO", logo: "/images/client/drdo.png" }, { name: "DUAC", logo: "/images/client/duac.png" }, { name: "ICMR-NIV", logo: "/images/client/icmr-niv.jpg" }, { name: "IIMR", logo: "/images/client/iimr.png" }, { name: "IISERB", logo: "/images/client/iiserb.png" }, { name: "ILBS", logo: "/images/client/ilbs.jpg" }, { name: "Manipal", logo: "/images/client/manipal.png" }, { name: "Rani", logo: "/images/client/rani.png" }, { name: "OUAT", logo: "/images/client/Ouat.png" }, { name: "AIIMS", logo: "/images/client/aiims.png" }, { name: "IARI", logo: "/images/client/iari.png" }, { name: "KGMU", logo: "/images/client/kgmu.png" }, { name: "BHU", logo: "/images/client/bhu.png" } ]; // Triple the array for seamless infinite loop const infiniteClients = [...clients, ...clients, ...clients]; const itemWidth = 100 / 50; // Each item is 1/6 of the container const singleSetWidth = clients.length * itemWidth; // Width of one complete set useEffect(() => { const timer = setInterval(() => { setTranslateX(prev => { const newTranslateX = prev + itemWidth; // When we reach the end of the second set, reset to the beginning of the second set if (newTranslateX >= singleSetWidth * 1) { // Temporarily disable transition for seamless reset setIsTransitioning(false); setTimeout(() => { setTranslateX(singleSetWidth); // Reset to start of second set setIsTransitioning(true); }, 50); return prev; } return newTranslateX; }); }, 3000); return () => clearInterval(timer); }, [itemWidth, singleSetWidth]); return (

Trusted By Leading Institutions

Trusted Institutions
{/* Slider Container */}
{infiniteClients.map((client, index) => (
{client.name}
))}
); }; export default ClientsSection;