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

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="medium"
            sizing="largeSizeMediumTitles"
            background="circleGradient"
            cardStyle="soft-shadow"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleApple
                        brandName="Mandarin"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "featured" },
                            { name: "About", id: "about" },
                            { name: "Why Us", id: "features" },
                            { name: "Contact", id: "contact" }
                        ]}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest News & Insights"
                            description="Discover our latest articles, guides, and insights about Mandarin language learning and culture"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    )}

                    <FooterLogoReveal
                        logoText="Mandarin"
                        leftLink={{
                            text: "Privacy Policy",                            href: "#"
                        }}
                        rightLink={{
                            text: "Terms of Service",                            href: "#"
                        }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}