"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from "@/components/sections/blog/BlogCardThree";
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="hover-magnetic"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="compact"
            sizing="largeSmallSizeLargeTitles"
            background="circleGradient"
            cardStyle="layered-gradient"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Artistry"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Portfolio", id: "/portfolio" },
                            { name: "About", id: "/about" },
                            { name: "Contact", id: "/contact" }
                        ]}
                        button={{ text: "View Collections", href: "/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">
                        <BlogCardThree
                            blogs={posts}
                            title="Creative Insights"
                            description="Explore our latest thoughts on art, design, and creative expression"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Home", href: "/" },
                                    { label: "Portfolio", href: "/portfolio" },
                                    { label: "About", href: "/about" },
                                    { label: "Contact", href: "/contact" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "Email", href: "mailto:contact@artistry.com" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "/privacy" },
                                    { label: "Terms of Service", href: "/terms" },
                                    { label: "Copyright Info", href: "/copyright" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Artistry. All artwork rights reserved."
                        bottomRightText="Crafted with creative passion"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}