"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { PenTool } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="small"
            sizing="largeSmallSizeLargeTitles"
            background="circleGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="APEX"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Shop", id: "products" },
                            { name: "Community", id: "testimonials" },
                            { 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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Streetwear Insights"
                            description="Stay ahead of the game with our latest fashion insights, style tips, and community stories"
                            tag="Blog"
                            tagIcon={PenTool}
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tagAnimation="slide-up"
                            buttonAnimation="slide-up"
                            buttons={[
                                { text: "View All Posts", href: "/blog" }
                            ]}
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="APEX"
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "New Arrivals", href: "#products" },
                                    { label: "Collections", href: "#products" },
                                    { label: "Limited Editions", href: "#products" },
                                    { label: "Collaborations", href: "#products" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Our Story", href: "#about" },
                                    { label: "Testimonials", href: "#testimonials" },
                                    { label: "Ambassador Program", href: "#contact" },
                                    { label: "Events", href: "#contact" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "FAQ", href: "#faq" },
                                    { label: "Shipping Info", href: "#faq" },
                                    { label: "Returns", href: "#faq" },
                                    { label: "Contact Us", href: "#contact" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "TikTok", href: "https://tiktok.com" },
                                    { label: "Discord", href: "https://discord.com" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 APEX Streetwear. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}