import BlogCard1 from '@/components/cards/blog-card-1'; import { Button } from '@/components/ui/button'; import { Carousel, type CarouselApi, CarouselContent, CarouselItem } from '@/components/ui/carousel'; import { getPageSection } from '@/lib/page'; import { cn } from '@/lib/utils'; import { IntroPageProps } from '@/types/page'; import { usePage } from '@inertiajs/react'; import Autoplay from 'embla-carousel-autoplay'; import { ChevronLeft, ChevronRight } from 'lucide-react'; import { useEffect, useState } from 'react'; import Section from '../section'; const Blogs = () => { const { props } = usePage(); const { page, customize, blogs } = props; const blogsSection = getPageSection(page, 'blogs'); const [api, setApi] = useState(); const [currentSlide, setCurrentSlide] = useState(0); useEffect(() => { if (!api) { return; } const handleSelect = () => { setCurrentSlide(api.selectedScrollSnap()); }; api.on('select', handleSelect); return () => { api.off('select', handleSelect); }; }, [api]); return (

{blogsSection?.title}

{blogsSection?.description}

{blogs.map((blog) => (
))}
{api && blogs.map(({ id }, index) => (
api.scrollTo(index)} >
))}
); }; export default Blogs;