"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 NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="mediumSmall"
            sizing="mediumLargeSizeLargeTitles"
            background="circleGradient"
            cardStyle="outline"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="Portfolio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Projects", id: "projects" },
                            { name: "About", id: "about" },
                            { name: "Experience", id: "metrics" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Based in Global"
                        bottomRightText="hello@portfolio.com"
                    />
                </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"
                            description="Discover our thoughts on design, development, and digital innovation"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoReveal
                        logoText="Portfolio"
                        leftLink={{
                            text: "Privacy Policy",                            href: "#"
                        }}
                        rightLink={{
                            text: "Terms of Service",                            href: "#"
                        }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}