"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="icon-arrow"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="mediumLarge"
            sizing="largeSmall"
            background="aurora"
            cardStyle="subtle-shadow"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="George's Gyros"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "About", id: "about" },
                            { name: "Why Us", id: "features" },
                            { name: "Reviews", id: "testimonials" }
                        ]}
                        button={{ text: "Order Online", href: "#contact" }}
                    />
                </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">
                        <BlogCardThree
                            blogs={posts}
                            title="Fresh from the Kitchen"
                            description="Discover authentic Mediterranean flavors and culinary traditions from George's kitchen"
                            tag="George's Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "George's Gyros",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Menu", href: "#menu" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Quick Links",                                items: [
                                    { label: "Order Online", href: "https://example.com/order" },
                                    { label: "Delivery Info", href: "#" },
                                    { label: "Careers", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "Reviews", href: "#testimonials" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 George's Gyros. Taste the Mediterranean—Fast."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}