"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="icon-arrow"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="mediumLarge"
            sizing="mediumLargeSizeMediumTitles"
            background="none"
            cardStyle="glass-depth"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About Us", id: "about" },
                            { name: "Products", id: "products" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "contact" },
                        ]}
                        brandName="Смачна Випічка"
                    />
                </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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Articles"
                            description="Insights and updates from our team"
                            animationType="slide-up"
                            textboxLayout="default"
                            useInvertedBackground={false}
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Menu",                                items: [
                                    { label: "Breads", href: "#products" },
                                    { label: "Pastries", href: "#products" },
                                    { label: "Special Orders", href: "#contact" },
                                ],
                            },
                            {
                                title: "Bakery",                                items: [
                                    { label: "Our Story", href: "#about" },
                                    { label: "FAQ", href: "#faq" },
                                    { label: "Contact", href: "#contact" },
                                ],
                            },
                        ]}
                        copyrightText="© 2024 Смачна Випічка. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
