"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="icon-arrow"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="compact"
            sizing="largeSmallSizeMediumTitles"
            background="blurBottom"
            cardStyle="glass-depth"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Blog", id: "/blog" },
                            { name: "Shop", id: "/shop" },
                        ]}
                        button={{ text: "Shop Now", href: "/shop" }}
                        brandName="Dring Together"
                    />
                </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
                                posts={posts}
                                title="Latest Articles"
                                description="Insights and updates from our team"
                                animationType="slide-up"
                                textboxLayout="default"
                                useInvertedBackground={false}
                                carouselMode="buttons"
                            />
                        </div>
                    )}

            </ReactLenis>
        </ThemeProvider>
    );
}
