"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay';
import { useBlogPosts } from "@/hooks/useBlogPosts";

export default function BlogPage() {
    const { posts, isLoading } = useBlogPosts();

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="compact"
            sizing="largeSmallSizeLargeTitles"
            background="circleGradient"
            cardStyle="soft-shadow"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Portfolio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Projects", id: "projects" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "View Work", href: "projects" }}
                    />
                </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="Featured Articles"
                            description="Explore our latest insights and perspectives on design, development, and innovation"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="Portfolio"
                        columns={[
                            {
                                title: "Navigation",                                items: [
                                    { label: "Home", href: "#hero" },
                                    { label: "About", href: "#about" },
                                    { label: "Projects", href: "#projects" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "GitHub", href: "https://github.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "Dribbble", href: "https://dribbble.com" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Blog", href: "#blog" },
                                    { label: "Case Studies", href: "#case-studies" },
                                    { label: "Design Tips", href: "#tips" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Portfolio. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}