"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterSimple from '@/components/sections/footer/FooterSimple';
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-stagger"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="compact"
            sizing="mediumLarge"
            background="floatingGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Luxe"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Reviews", id: "reviews" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Articles"
                            description="Discover insights, trends, and stories from our team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "All Products", href: "#" },
                                    { label: "New Arrivals", href: "#" },
                                    { label: "Best Sellers", href: "#" },
                                    { label: "Sale", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#" },
                                    { label: "Our Story", href: "#" },
                                    { label: "Sustainability", href: "#" },
                                    { label: "Careers", href: "#" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Contact Us", href: "#" },
                                    { label: "Shipping Info", href: "#" },
                                    { label: "Returns", href: "#" },
                                    { label: "FAQ", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Luxe Essentials. All rights reserved."
                        bottomRightText="Crafted with excellence"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}