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

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="small"
            sizing="medium"
            background="none"
            cardStyle="elevated"
            primaryButtonStyle="flat"
            secondaryButtonStyle="glass"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Projects", id: "gallery" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Get Started", href: "contact" }}
                        brandName="Portfolio"
                    />
                </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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Articles"
                            description="Discover insights, tips, and stories from our creative journey"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="Portfolio"
                        columns={[
                            {
                                title: "Work",                                items: [
                                    { label: "Projects", href: "#gallery" },
                                    { label: "Case Studies", href: "#" },
                                    { label: "Portfolio", href: "#" }
                                ]
                            },
                            {
                                title: "About",                                items: [
                                    { label: "About Me", href: "#about" },
                                    { label: "Resume", href: "#" },
                                    { label: "Services", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Email", href: "mailto:hello@example.com" },
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "Twitter", href: "https://twitter.com" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Creative Portfolio. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}