"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from "@/components/sections/blog/BlogCardThree";
import FooterBase from "@/components/sections/footer/FooterBase";
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="background-highlight"
            borderRadius="rounded"
            contentWidth="small"
            sizing="mediumLargeSizeMediumTitles"
            background="noise"
            cardStyle="outline"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="LogisticNet"
                        navItems={[
                            { name: "Home", id: "/" }
                        ]}
                        button={{ text: "Contact", href: "/contact" }}
                    />
                </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="Latest Insights"
                            description="Explore our latest insights and industry expertise in logistics and supply chain management"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tagAnimation="opacity"
                            buttonAnimation="opacity"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="LogisticNet"
                        copyrightText="© 2025 LogisticNet. All rights reserved. Integrated Logistics for the Modern Enterprise."
                        columns={[
                            {
                                title: "Company",                                items: [
                                    { label: "Home", href: "/" },
                                    { label: "About Us", href: "/about" },
                                    { label: "Contact Us", href: "/contact" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}