"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBaseReveal from "@/components/sections/footer/FooterBaseReveal";
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="text-stagger"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="medium"
            background="aurora"
            cardStyle="layered-gradient"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background" id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Globus"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Shop Now", href: "products" }}
                    />

                    {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">
                            <BlogCardOne
                                blogs={posts}
                                title="Latest Insights"
                                description="Discover the latest trends, tips, and innovations in premium drinkware and lifestyle"
                                textboxLayout="default"
                                useInvertedBackground="noInvert"
                                carouselMode="buttons"
                                animationType="slide-up"
                                tag="Blog"
                                ariaLabel="Blog section"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterBaseReveal
                            columns={[
                                {
                                    title: "Products",                                    items: [
                                        { label: "All Cups", href: "products" },
                                        { label: "Collections", href: "products" },
                                        { label: "New Arrivals", href: "products" }
                                    ]
                                },
                                {
                                    title: "Company",                                    items: [
                                        { label: "About Us", href: "about" },
                                        { label: "Sustainability", href: "about" },
                                        { label: "Careers", href: "#" }
                                    ]
                                },
                                {
                                    title: "Support",                                    items: [
                                        { label: "Contact Us", href: "contact" },
                                        { label: "Shipping Info", href: "#" },
                                        { label: "Returns", href: "#" }
                                    ]
                                }
                            ]}
                            copyrightText="© 2025 Globus Cups | Premium Drinkware Since 2010"
                        />
                    </div>
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}