"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="bounce-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="smallMedium"
            sizing="largeSizeMediumTitles"
            background="blurBottom"
            cardStyle="gradient-mesh"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Pepper Peak"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "/#about" },
                            { name: "Flavors", id: "/#flavors" },
                            { name: "Testimonials", id: "/#testimonials" },
                            { name: "Contact", id: "/#contact" },
                        ]}
                    />
                </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="From Our Blog"
                            description="Explore the latest news, tips, and stories from our team."
                            animationType="slide-up"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/chili-sauce-peppers-dark-wooden-surface_1150-42161.jpg?_wi=3"
                        imageAlt="Hot sauce bottles background"
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "Hot Sauces", href: "#flavors" },
                                    { label: "Bundles", href: "/bundles" },
                                    { label: "Merchandise", href: "/merch" },
                                ],
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "Our Story", href: "#about" },
                                    { label: "FAQ", href: "#faq" },
                                    { label: "Contact Us", href: "#contact" },
                                ],
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "/privacy" },
                                    { label: "Terms of Service", href: "/terms" },
                                ],
                            },
                        ]}
                        logoText="Pepper Peak"
                        copyrightText="© 2024 Pepper Peak. All rights reserved."
                        ariaLabel="Site footer with navigation and hot sauce imagery"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
