"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 NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="mediumSmall"
            sizing="large"
            background="floatingGradient"
            cardStyle="soft-shadow"
            primaryButtonStyle="flat"
            secondaryButtonStyle="layered"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleApple
                        brandName="Ranok"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Menu", id: "products" },
                            { name: "Community", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="Coffee Stories"
                            description="Discover the art and culture behind every cup at Ranok Coffee"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    )}

                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Ranok",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Menu", href: "products" },
                                    { label: "Community", href: "testimonials" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "Contact Us", href: "contact" }
                                ]
                            },
                            {
                                title: "Visit",                                items: [
                                    { label: "Directions", href: "https://maps.google.com" },
                                    { label: "Hours", href: "contact" },
                                    { label: "Book Event", href: "contact" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Ranok Coffee. Crafted with passion, served with care."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}