import React, { useState, useEffect, useCallback } from 'react'; import { ChevronLeft, ChevronRight } from 'lucide-react'; import { navigateTo } from './Router'; import svgPaths from "../imports/svg-i1joeov37f"; interface SlideData { id: number; title: string; description: string; backgroundImage: string; shortTitle: string; } export default function HeroSection() { const [currentSlide, setCurrentSlide] = useState(0); const [isAutoPlaying, setIsAutoPlaying] = useState(true); const [progressValues, setProgressValues] = useState([0, 0, 0]); const slides: SlideData[] = [ { id: 1, title: "Empowering Future-Ready\nLeaders", description: "Build confidence, agility, and clarity for today's complex challenges.", backgroundImage: "https://images.unsplash.com/photo-1552664730-d307ca884978?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1920&q=80", shortTitle: "Leadership Is Learned. We Teach It Right." }, { id: 2, title: "Turn Managers into\nImpactful Leaders", description: "Transform your management team into visionary leaders who inspire teams, drive innovation, and achieve exceptional business outcomes.", backgroundImage: "https://images.unsplash.com/photo-1600880292203-757bb62b4baf?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1920&q=80", shortTitle: "Turn Managers into Impactful Leaders" }, { id: 3, title: "Struggling with\nManagerial Gaps?", description: "Bridge the leadership gap in your organization with our proven methodologies that develop confident, capable leaders at every level.", backgroundImage: "https://images.unsplash.com/photo-1542744173-8e7e53415bb0?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1920&q=80", shortTitle: "Struggling with Managerial Gaps?" } ]; const totalSlides = slides.length; const slideDuration = 5000; // 5 seconds per slide // Auto-advance slides useEffect(() => { if (!isAutoPlaying) return; const interval = setInterval(() => { setCurrentSlide((prev) => (prev + 1) % totalSlides); }, slideDuration); return () => clearInterval(interval); }, [isAutoPlaying, totalSlides]); // Progress bar animation useEffect(() => { if (!isAutoPlaying) return; const interval = setInterval(() => { setProgressValues(prev => { const newProgress = [...prev]; newProgress[currentSlide] = Math.min(newProgress[currentSlide] + (100 / (slideDuration / 100)), 100); // Reset progress when slide changes if (newProgress[currentSlide] >= 100) { newProgress[currentSlide] = 0; // Reset other slides newProgress.forEach((_, index) => { if (index !== currentSlide) { newProgress[index] = 0; } }); } return newProgress; }); }, 100); return () => clearInterval(interval); }, [currentSlide, isAutoPlaying]); // Reset progress when manually changing slides useEffect(() => { setProgressValues(prev => { const newProgress = [0, 0, 0]; newProgress[currentSlide] = 0; return newProgress; }); }, [currentSlide]); const goToSlide = useCallback((slideIndex: number) => { if (slideIndex !== currentSlide) { setCurrentSlide(slideIndex); setIsAutoPlaying(false); // Resume auto-play after manual interaction setTimeout(() => setIsAutoPlaying(true), 3000); } }, [currentSlide]); const nextSlide = useCallback(() => { const next = (currentSlide + 1) % totalSlides; goToSlide(next); }, [currentSlide, totalSlides, goToSlide]); const prevSlide = useCallback(() => { const prev = (currentSlide - 1 + totalSlides) % totalSlides; goToSlide(prev); }, [currentSlide, totalSlides, goToSlide]); // Pause auto-play on hover const handleMouseEnter = () => setIsAutoPlaying(false); const handleMouseLeave = () => setIsAutoPlaying(true); return (
{/* Background Slides */} {slides.map((slide, index) => (
))} {/* Hero Content */}
{/* Title */}

{slides[currentSlide].title}

{/* Description */}

{slides[currentSlide].description}

{/* Build Your Leadership Pipeline Button - Enhanced with Proper Navigation */}
{/* Bottom Navigation */}
{/* Progress Section */}
{slides.map((slide, index) => (
goToSlide(index)} > {/* Progress Bar */}
{/* Progress Number */}
{String(index + 1).padStart(2, '0')}
{/* Progress Text */}
{slide.shortTitle}
))}
{/* Navigation Arrows */}
); }