"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="elastic-effect"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="compact"
            sizing="mediumSizeLargeTitles"
            background="noiseDiagonalGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <NavbarStyleCentered
                    navItems={[
                        { name: "Home", id: "/" },
                        { name: "About Us", id: "about" },
                        { name: "Services", id: "services" },
                        { name: "Case Studies", id: "product" },
                        { name: "Testimonials", id: "testimonials" },
                        { name: "FAQ", id: "faq" },
                        { name: "Contact", id: "contact" },
                    ]}
                    button={{ text: "Get Started", href: "contact" }}
                    brandName="Spike Media"
                />

                {isLoading ? (
                    <div className="w-content-width mx-auto py-20 text-center">
                        <p className="text-foreground">Loading posts...</p>
                    </div>
                ) : (
                    <BlogCardThree
                        blogs={posts}
                        title="Featured Articles"
                        description="Explore our latest insights"
                        animationType="slide-up"
                        textboxLayout="default"
                        useInvertedBackground={false}
                        carouselMode="buttons"
                    />
                )}

                <FooterBaseReveal
                    columns={[
                        {
                            title: "Services",                            items: [
                                { label: "Strategy", href: "services" },
                                { label: "Creation", href: "services" },
                                { label: "Management", href: "services" },
                            ],
                        },
                        {
                            title: "Company",                            items: [
                                { label: "About Us", href: "about" },
                                { label: "Case Studies", href: "product" },
                                { label: "Contact", href: "contact" },
                            ],
                        },
                        {
                            title: "Resources",                            items: [
                                { label: "FAQ", href: "faq" },
                                { label: "Testimonials", href: "testimonials" },
                            ],
                        },
                    ]}
                    copyrightText="© 2024 Spike Media. All rights reserved."
                />
            </ReactLenis>
        </ThemeProvider>
    );
}
