"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 NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="bounce-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="compact"
            sizing="mediumSizeLargeTitles"
            background="aurora"
            cardStyle="gradient-mesh"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Portfolio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Work", id: "gallery" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Articles"
                            description="Explore our latest insights and updates from the team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigation",                                items: [
                                    { label: "Home", href: "#hero" },
                                    { label: "Portfolio", href: "#gallery" },
                                    { label: "About", href: "#about" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "GitHub", href: "https://github.com" },
                                    { label: "Twitter", href: "https://twitter.com" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Blog", href: "#" },
                                    { label: "Case Studies", href: "#" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Portfolio. All rights reserved."
                        bottomRightText="Crafted with care using modern web technologies"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}