import React, { useState, useEffect } from 'react'; import { ChevronLeft, ChevronRight } from 'lucide-react'; interface CarouselProps { className?: string; } const Carousel: React.FC = ({ className = '' }) => { const [currentIndex, setCurrentIndex] = useState(0); const [isAutoPlaying, setIsAutoPlaying] = useState(true); // Array of carousel images const images = [ { src: '/carousel_1.png', alt: 'Professional welding services - Industrial welding work', label: 'Industrial Welding' }, { src: '/carousel_2.png', alt: 'Custom metal fabrication - Precision metalwork', label: 'Custom Fabrication' }, { src: '/carousel_3.png', alt: 'Structural steel welding - Large scale projects', label: 'Structural Steel' }, { src: '/carousel_4.png', alt: 'Modern welding facility - Professional workspace', label: 'Modern Facility' }, { src: '/carousel_5.png', alt: 'Quality control and inspection - Precision work', label: 'Quality Assurance' }, { src: '/carousel_6.png', alt: 'Professional welding team - Expert craftsmen', label: 'Expert Team' } ]; // Auto-advance carousel every 8 seconds useEffect(() => { if (!isAutoPlaying) return; const interval = setInterval(() => { setCurrentIndex((prev) => (prev + 1) % images.length); }, 8000); return () => clearInterval(interval); }, [isAutoPlaying, images.length]); const goToSlide = (index: number) => { setCurrentIndex(index); setIsAutoPlaying(false); // Resume auto-play after 15 seconds of manual interaction setTimeout(() => setIsAutoPlaying(true), 15000); }; const goToPrevious = () => { setCurrentIndex((prev) => (prev - 1 + images.length) % images.length); setIsAutoPlaying(false); setTimeout(() => setIsAutoPlaying(true), 15000); }; const goToNext = () => { setCurrentIndex((prev) => (prev + 1) % images.length); setIsAutoPlaying(false); setTimeout(() => setIsAutoPlaying(true), 15000); }; return (
{/* Main Carousel Container - Dispel Style */}
{/* Images Container */}
{images.map((image, index) => (
{image.alt} {/* Subtle overlay */}
{/* Label - Dispel Style */}
{image.label} →
))}
{/* Dots Indicator */}
{images.map((_, index) => (
); }; export default Carousel;