use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="compact"
            sizing="largeSmallSizeLargeTitles"
            background="circleGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <NavbarStyleApple
                    brandName="No song"
                    navItems={[
                        { name: "Home", id: "/" },
                        { name: "Hero", id: "hero-section" },
                        { name: "About", id: "about-section" },
                        { name: "Feature", id: "features-section" },
                        { name: "Product", id: "products-section" },
                        { name: "Testimonial", id: "testimonials-section" },
                        { name: "Contact", id: "contact-section" },
                        { name: "Footer", id: "footer-section" },
                    ]}
                />

                {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="Featured Articles"
                            description="Explore our latest insights"
                            animationType="slide-up"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                        />
                    </div>
                )}

                {/* No footer is rendered as per the empty FOOTER_INFO and FOOTER_PROPS_SCHEMA */}
            </ReactLenis>
        </ThemeProvider>
    );
}
