@@ -2,11 +2,13 @@ import { useState, useEffect } from "react";
22import teamMembers from "../config/teammate" ;
33import { ArrowLeft , ArrowRight } from "lucide-react" ;
44import { FaLinkedin , FaXTwitter } from "react-icons/fa6" ;
5+ import { useNavigate } from "react-router" ;
56
67const TeamSlider = ( ) => {
78 const [ currentIndex , setCurrentIndex ] = useState ( 0 ) ;
89 const [ visibleCount , setVisibleCount ] = useState ( 1 ) ;
910
11+ const navigate = useNavigate ( ) ;
1012 const getVisibleCount = ( ) => {
1113 if ( window . innerWidth < 768 ) return 1 ;
1214 if ( window . innerWidth < 1024 ) return 2 ;
@@ -31,11 +33,12 @@ const TeamSlider = () => {
3133
3234 const nextSlide = ( ) => {
3335 const maxIndex = Math . max ( 0 , teamMembers . length - visibleCount ) ;
34- setCurrentIndex ( ( prev ) => Math . min ( prev + visibleCount , maxIndex ) ) ;
36+ setCurrentIndex ( ( prev ) => ( prev >= maxIndex ? 0 : prev + visibleCount ) ) ;
3537 } ;
3638
3739 const prevSlide = ( ) => {
38- setCurrentIndex ( ( prev ) => Math . max ( prev - visibleCount , 0 ) ) ;
40+ const maxIndex = Math . max ( 0 , teamMembers . length - visibleCount ) ;
41+ setCurrentIndex ( ( prev ) => ( prev <= 0 ? maxIndex : prev - visibleCount ) ) ;
3942 } ;
4043
4144 return (
@@ -44,7 +47,13 @@ const TeamSlider = () => {
4447 < div className = "mb-10" >
4548 < h2 className = "text-3xl font-bold mb-2 ml-3" > Our team</ h2 >
4649 < p className = "text-xl text-gray-300 ml-3" > </ p >
47- < button className = "mt-4 border border-white text-white py-2 px-4 ml-3 rounded hover:bg-white hover:text-[#00163A] transition cursor-pointer" >
50+ < button
51+ onClick = { ( ) => {
52+ navigate ( "/Team" ) ;
53+ window . scrollTo ( 0 , 0 ) ;
54+ } }
55+ className = "mt-4 border border-white text-white py-2 px-4 ml-3 rounded hover:bg-white hover:text-[#00163A] transition cursor-pointer"
56+ >
4857 View all team members
4958 </ button >
5059 </ div >
0 commit comments