"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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="hover-magnetic"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="small"
            sizing="mediumLargeSizeMediumTitles"
            background="none"
            cardStyle="outline"
            primaryButtonStyle="flat"
            secondaryButtonStyle="glass"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="SneakElite"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "Support", id: "faq" }
                        ]}
                        button={{ text: "View Cart", href: "#" }}
                    />
                </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="Featured Sneaker Articles"
                            description="Discover the latest trends, reviews, and insights in the sneaker world"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "New Releases", href: "#products" },
                                    { label: "Collections", href: "#" },
                                    { label: "Limited Drops", href: "#" },
                                    { label: "Best Sellers", href: "#" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Blog", href: "#" },
                                    { label: "Reviews", href: "#testimonials" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "FAQ", href: "#faq" },
                                    { label: "Authentication", href: "#" },
                                    { label: "Shipping Info", href: "#" },
                                    { label: "Privacy Policy", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 SneakElite. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}