'use client'; import { Carousel, CarouselContent, CarouselItem, type CarouselApi } from '@/components/ui/carousel'; import { cn } from '@/lib/utils'; import Autoplay from 'embla-carousel-autoplay'; import { CheckCircle, Handshake, Lock, Zap } from 'lucide-react'; import { useEffect, useState } from 'react'; const upgradePlanData = [ { icon: Zap, title: 'Remove watermarks', description: 'Export up to 50 watermark-free videos, perfect for posting to your creator channel (8ยข per video)', }, { icon: CheckCircle, title: 'Personal license included', description: 'Full rights to use videos for personal social media, creator and non-commercial projects', }, { icon: Lock, title: 'Lock in your pricing', description: 'Subscribe now and keep this price forever - even when we raise prices for new users', }, { icon: Handshake, title: 'Support our development', description: 'Help us to improve and grow so you get the best features & experience', }, ]; const UpgradePlanCarousel = () => { const [api, setApi] = useState(); const [current, setCurrent] = useState(0); const [count, setCount] = useState(0); useEffect(() => { if (!api) { return; } setCount(api.scrollSnapList().length); setCurrent(api.selectedScrollSnap() + 1); api.on('select', () => { setCurrent(api.selectedScrollSnap() + 1); }); }, [api]); const scrollTo = (index: number) => { api?.scrollTo(index); }; return (
{upgradePlanData.map((item, index) => { const IconComponent = item.icon; return (

{item.title}

{item.description}

); })}
{/* Centered Dot Navigation */}
{Array.from({ length: count }, (_, index) => (
); }; export default UpgradePlanCarousel;