"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterLogoReveal from "@/components/sections/footer/FooterLogoReveal";
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="expand-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="smallMedium"
            sizing="mediumLarge"
            background="aurora"
            cardStyle="elevated"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleCentered
                        brandName="Baruga"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Products", id: "products" },
                            { name: "Visit Us", id: "contact" },
                            { name: "FAQ", id: "faq" }
                        ]}
                        button={{ text: "Order Online", href: "contact" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardOne
                            blogs={posts}
                            title="Fresh Insights from Baruga"
                            description="Discover our latest culinary stories, cooking tips, and behind-the-scenes updates from our kitchen"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    )}

                    <FooterLogoReveal
                        logoText="Baruga"
                        leftLink={{ text: "Privacy Policy", href: "#privacy" }}
                        rightLink={{ text: "Contact Us", href: "contact" }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
