"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
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-shift"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="smallMedium"
            sizing="mediumSizeLargeTitles"
            background="aurora"
            cardStyle="soft-shadow"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="StartupLabs"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Team", id: "team" },
                            { name: "Features", id: "features" },
                            { name: "Investors", id: "investors" },
                            { name: "Contact", id: "contact" },
                            { name: "Shop", id: "/shop" }
                        ]}
                        bottomLeftText="San Francisco, CA"
                        bottomRightText="hello@startuplabs.io"
                    />
                </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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Articles"
                            description="Insights and updates from our team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoReveal
                        logoText="StartupLabs"
                        leftLink={{
                            text: "Privacy Policy",                            href: "https://example.com/privacy"
                        }}
                        rightLink={{
                            text: "Terms of Service",                            href: "https://example.com/terms"
                        }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}