"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="shift-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="compact"
            sizing="largeSmallSizeLargeTitles"
            background="floatingGradient"
            cardStyle="gradient-mesh"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="glass"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingInline
                        brandName="Jake Young"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Services", id: "services" },
                            { name: "Portfolio", id: "portfolio" },
                            { name: "Testimonials", id: "testimonials" }
                        ]}
                        button={{ text: "Get Started", href: "#contact" }}
                    />

                    {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 Insights"
                            description="Explore the latest trends and insights in web development, design, and digital strategy"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    )}

                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Home", href: "#" },
                                    { label: "About", href: "#about" },
                                    { label: "Services", href: "#services" },
                                    { label: "Portfolio", href: "#portfolio" }
                                ]
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Web Design", href: "#services" },
                                    { label: "E-Commerce", href: "#services" },
                                    { label: "Web Apps", href: "#services" },
                                    { label: "Consulting", href: "#contact" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Email", href: "mailto:jake@example.com" },
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Jake Young. All rights reserved."
                        bottomRightText="Built with excellence and American pride"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}