"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 NavbarLayoutFloatingInline from "@/components/navbar/NavbarLayoutFloatingInline";
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="small"
            sizing="largeSmallSizeLargeTitles"
            background="circleGradient"
            cardStyle="glass-depth"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingInline
                        brandName="United States"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Heritage", id: "about" },
                            { name: "Values", id: "feature" },
                            { name: "Achievements", id: "metric" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Join the Movement", 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="American Stories & Insights"
                            description="Discover the latest perspectives on American values, heritage, and democratic ideals that shape our nation's future"
                            tag="National Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    )}

                    <FooterLogoReveal
                        logoText="USA"
                        leftLink={{ text: "Privacy & Rights", href: "/privacy" }}
                        rightLink={{ text: "Democratic Values", href: "/values" }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}