"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBaseCard from "@/components/sections/footer/FooterBaseCard";
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="directional-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="mediumSizeLargeTitles"
            background="floatingGradient"
            cardStyle="glass-elevated"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingInline
                        brandName="Lorenzo Noya"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Work", id: "features" },
                            { name: "Insights", id: "blog" },
                            { name: "Get in Touch", id: "contact" }
                        ]}
                        button={{ text: "Connect", href: "#contact" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardOne
                            blogs={posts}
                            title="Insights & Thoughts"
                            description="Exploring ideas at the intersection of product, design, and technology"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    )}

                    <FooterBaseCard
                        logoText="Lorenzo Noya"
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "About", href: "#about" },
                                    { label: "Work", href: "#features" },
                                    { label: "Testimonials", href: "#testimonials" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Links",                                items: [
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "Webild", href: "https://webild.io" },
                                    { label: "Email", href: "mailto:lorenzo@webild.io" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Resume", href: "#" },
                                    { label: "Blog", href: "#" },
                                    { label: "Speaking", href: "#" },
                                    { label: "Advisories", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Lorenzo Noya. Head of Product @ Webild."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}