"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 FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import Link from 'next/link';

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

    const navItems = [
        { name: "Home", id: "/" },
        { name: "Blog", id: "/blog" },
        { name: "Shop", id: "/shop" },
    ];

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="medium"
            sizing="mediumLargeSizeLargeTitles"
            background="blurBottom"
            cardStyle="glass-elevated"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        navItems={navItems}
                        brandName="bb.q chicken"
                    />
                </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}
                                carouselMode="buttons"
                                ariaLabel="Our latest articles"
                                tag="Blog"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterBaseCard
                            logoText="bb.q chicken"
                            columns={[
                                {
                                    title: "Restaurant",                                    items: [
                                        { label: "Hours", href: "#" },
                                        { label: "Contact", href: "#contact" },
                                        { label: "Location", href: "#dine-in" },
                                        { label: "Online Ordering", href: "#order" },
                                    ],
                                },
                                {
                                    title: "Follow Us",                                    items: [
                                        { label: "Instagram", href: "#" },
                                        { label: "Facebook", href: "#" },
                                        { label: "TikTok", href: "#" },
                                    ],
                                },
                            ]}
                            copyrightText="© 2024 bb.q chicken — Columbus. All rights reserved."
                            ariaLabel="Site footer with navigation and social links."
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
