"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="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="compact"
            sizing="large"
            background="circleGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "Peking Duck", id: "duck" },
                            { name: "About", id: "about" },
                            { name: "Visit", id: "visit" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="Moys"
                        bottomLeftText="Near OSU Campus • Cozy Seating"
                        bottomRightText="Call for Reservations"
                    />
                </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="Culinary Stories"
                            description="Discover the traditions and stories behind our authentic Chinese cuisine"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoReveal
                        logoText="Moys"
                        leftLink={{
                            text: "Hours & Location",                            href: "#visit"
                        }}
                        rightLink={{
                            text: "Call (614) 291-MOYS",                            href: "tel:+16142916699"
                        }}
                        ariaLabel="Moys Chinese Restaurant footer"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}