"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="smallMedium"
            sizing="mediumSizeLargeTitles"
            background="grid"
            cardStyle="inset"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <NavbarLayoutFloatingOverlay
                    brandName="Bella Italia"
                    navItems={[
                        { name: "Home", id: "/" },
                        { name: "Shop", id: "/shop" },
                    ]}
                    button={{ text: "Reserve a Table", href: "/#contact" }}
                    className="py-4 px-6"
                    buttonClassName="px-5 py-2"
                />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <main>
                            <BlogCardTwo
                                blogs={posts}
                                title="Latest Articles"
                                description="Insights and updates from our team"
                                animationType="slide-up"
                                textboxLayout="default"
                                useInvertedBackground={false}
                                carouselMode="buttons"
                            />
                        </main>
                    )}

            </ReactLenis>
        </ThemeProvider>
    );
}
