"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
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="shift-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="small"
            sizing="mediumSizeLargeTitles"
            background="none"
            cardStyle="outline"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Portfolio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Work", id: "projects" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Get in Touch", 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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Articles"
                            description="Stay updated with our latest insights and creative explorations"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="Portfolio"
                        copyrightText="© 2025 Creative Designer. All rights reserved."
                        columns={[
                            {
                                title: "Navigation",                                items: [
                                    { label: "About", href: "about" },
                                    { label: "Work", href: "projects" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                title: "Social",                                items: [
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "Dribbble", href: "https://dribbble.com" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Email Me", href: "mailto:hello@example.com" },
                                    { label: "Privacy Policy", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}