"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
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="entrance-slide"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="largeSmall"
            background="aurora"
            cardStyle="soft-shadow"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingInline
                        brandName="Clear"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Sustainability", id: "features" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "View Collection", href: "#products" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Articles"
                            description="Discover insights and stories from the world of sustainable fashion"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    )}

                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "New Arrivals", href: "#products" },
                                    { label: "Collections", href: "#products" },
                                    { label: "Sale", href: "#products" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Sustainability", href: "#features" },
                                    { label: "Impact Report", href: "#features" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Contact", href: "#contact" },
                                    { label: "FAQ", href: "#" },
                                    { label: "Returns", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Clear | Sustainable Fashion. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}