"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterMedia from '@/components/sections/footer/FooterMedia';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="smallMedium"
            sizing="mediumLargeSizeLargeTitles"
            background="aurora"
            cardStyle="solid"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Honey Bee"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Shop Now", href: "products" }}
                    />
                </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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Honey Bee Insights"
                            description="Discover the sweet stories behind our handcrafted ceramics"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        logoText="Honey Bee Cups"
                        imageSrc="https://img.b2bpic.net/free-photo/high-view-bowls-mugs-pottery-concept_23-2148679111.jpg"
                        imageAlt="Honey Bee Cups collection"
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "All Products", href: "products" },
                                    { label: "Featured Items", href: "products" },
                                    { label: "Gift Sets", href: "products" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Story", href: "about" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "FAQs", href: "contact" },
                                    { label: "Shipping Info", href: "contact" },
                                    { label: "Care Guide", href: "contact" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Honey Bee Cups. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}