"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="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="mediumLarge"
            sizing="largeSizeMediumTitles"
            background="aurora"
            cardStyle="glass-depth"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="StartupHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Team", id: "team" },
                            { name: "Investors", id: "investors" },
                            { name: "Features", id: "features" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="San Francisco, CA"
                        bottomRightText="hello@startuphub.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="StartupHub Insights"
                            description="Discover the latest trends, insights, and stories from the startup ecosystem"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

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