"use client";

import ReactLenis from "lenis/react";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import { useBlogPosts } from "@/hooks/useBlogPosts";

import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="compact"
            sizing="largeSmallSizeMediumTitles"
            background="noise"
            cardStyle="inset"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "/menu" },
                            { name: "About", id: "/about" },
                            { name: "Order Ahead", id: "/order" },
                        ]}
                        brandName="Midnight Cafe"
                    />
                </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="Featured Articles"
                                description="Explore our latest insights"
                                animationType="slide-up"
                                textboxLayout="default"
                                useInvertedBackground={false}
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterLogoEmphasis
                            columns={[
                                {
                                    items: [
                                        { label: "Home", href: "/" },
                                        { label: "Menu", href: "/menu" },
                                        { label: "About", href: "/about" },
                                        { label: "Order Ahead", href: "/order" },
                                    ],
                                },
                                {
                                    items: [
                                        { label: "Hours", href: "/contact#hours" },
                                        { label: "Contact", href: "/contact" },
                                        { label: "Instagram", href: "https://instagram.com/midnightcafe" },
                                    ],
                                },
                            ]}
                            logoText="Midnight Cafe"
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
