"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterLogoReveal from '@/components/sections/footer/FooterLogoReveal';
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="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="compact"
            sizing="mediumSizeLargeTitles"
            background="circleGradient"
            cardStyle="outline"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Companies", id: "companies" },
                            { name: "Journey", id: "journey" },
                            { name: "Work", id: "work" },
                            { name: "Contact", id: "contact" },
                            { name: "Features", id: "/features" }
                        ]}
                        button={{ text: "Let's Connect", href: "contact" }}
                        brandName="Webild"
                    />
                </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
                            blogs={posts}
                            title="Latest Insights & Articles"
                            description="Discover our latest thoughts on technology, design, and innovation"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoReveal
                        logoText="WEBILD"
                        leftLink={{ text: "Privacy", href: "/privacy" }}
                        rightLink={{ text: "Terms", href: "/terms" }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}