import { useState, useEffect } from "react" import { motion, AnimatePresence } from "framer-motion" import { ChevronLeft, ChevronRight, Play, Sparkles, Star, Zap } from "lucide-react" import "./Carousel.css" function Carousel() { const [currentSlide, setCurrentSlide] = useState(0) const [isAutoPlaying, setIsAutoPlaying] = useState(true) const slides = [ { id: 1, image: "/slider_image/banner1.jpg", title: "Premium Collections", subtitle: "Experience Premium Quality", description: "Discover our exclusive range of Premium products crafted for the discerning customer", cta: "Explore Collection", gradient: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)", accent: "#667eea", }, { id: 2, image: "/slider_image/banner2.webp", title: "Tech Innovation Hub", subtitle: "Future is Here", description: "Cutting-edge technology meets elegant design in our latest electronics collection", cta: "Shop Tech", gradient: "linear-gradient(135deg, #f093fb 0%, #f5576c 100%)", accent: "#f093fb", }, { id: 3, image: "/slider_image/banner3.webp", title: "Fashion Forward", subtitle: "Style Redefined", description: "Elevate your wardrobe with our curated selection of contemporary fashion", cta: "Browse Fashion", gradient: "linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)", accent: "#4facfe", }, { id: 4, image: "/slider_image/banner4.webp", title: "Home & Living", subtitle: "Premium Lifestyle", description: "Transform your space with our Premium home and lifestyle products", cta: "Discover Home", gradient: "linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)", accent: "#43e97b", }, { id: 5, image: "/slider_image/banner5.webp", title: "Gaming Universe", subtitle: "Level Up Your Game", description: "Professional gaming gear and accessories for the ultimate gaming experience", cta: "Game On", gradient: "linear-gradient(135deg, #fa709a 0%, #fee140 100%)", accent: "#fa709a", }, ] useEffect(() => { if (!isAutoPlaying) return const interval = setInterval(() => { setCurrentSlide((prev) => (prev + 1) % slides.length) }, 10000) return () => clearInterval(interval) }, [isAutoPlaying, slides.length]) const nextSlide = () => { setCurrentSlide((prev) => (prev + 1) % slides.length) setIsAutoPlaying(false) setTimeout(() => setIsAutoPlaying(true), 10000) } const prevSlide = () => { setCurrentSlide((prev) => (prev - 1 + slides.length) % slides.length) setIsAutoPlaying(false) setTimeout(() => setIsAutoPlaying(true), 10000) } const goToSlide = (index) => { setCurrentSlide(index) setIsAutoPlaying(false) setTimeout(() => setIsAutoPlaying(true), 10000) } return (
{}
{[...Array(50)].map((_, i) => ( ))}
{}
{}
{}
{}
{}
{} {slides[currentSlide].subtitle} {slides[currentSlide].title} {slides[currentSlide].description} {slides[currentSlide].cta}
{[...Array(6)].map((_, i) => (
))}
Watch Demo
{} {[ { label: "Products", value: "10K+" }, { label: "Customers", value: "50K+" }, { label: "Reviews", value: "4.9★" }, ].map((stat, index) => (
{stat.value}
{stat.label}
))}
{}
{} {slides.map((_, index) => ( goToSlide(index)} whileHover={{ scale: 1.2 }} whileTap={{ scale: 0.8 }} style={{ "--accent-color": slides[index].accent }} >
{index === currentSlide && ( )}
))}
{}
{currentSlide + 1}/{slides.length}
{}
) } export default Carousel