"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
import { useBlogPosts } from "@/hooks/useBlogPosts";

export default function BlogPage() {
    const { posts, isLoading } = useBlogPosts();

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="medium"
            sizing="largeSmall"
            background="floatingGradient"
            cardStyle="soft-shadow"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Hero", id: "hero-section" },
                            { name: "About", id: "about-section" },
                            { name: "Feature", id: "features-section" },
                            { name: "Product", id: "product-section" },
                            { name: "Testimonial", id: "testimonial-section" },
                            { name: "Contact", id: "contact-section" }
                        ]}
                        button={{ text: "Reserve Your Table", href: "#contact-section" }}
                        brandName="Fogo de Chão"
                    />
                </div>

                {isLoading ? (
                    <div className="w-content-width mx-auto py-20 text-center">
                        <p className="text-foreground">Loading posts...</p>
                    </div>
                ) : (
                    <div id="blog" data-section="blog">
                        <BlogCardThree
                            blogs={posts}
                            title="Culinary Excellence"
                            description="Discover the art of Brazilian churrasco and our passion for authentic flavors"
                            tag="Featured"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}
            </ReactLenis>
        </ThemeProvider>
    );
}