"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="bounce-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="small"
            sizing="largeSizeMediumTitles"
            background="floatingGradient"
            cardStyle="gradient-mesh"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="BlogHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Articles", id: "articles" },
                            { name: "Categories", id: "categories" },
                            { name: "About", id: "about" }
                        ]}
                        button={{ text: "Subscribe", href: "newsletter" }}
                    />
                </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">
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Explore our latest insights and discover new perspectives on technology, design, and innovation"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="BlogHub"
                        columns={[
                            {
                                title: "Categories",                                items: [
                                    { label: "Technology", href: "#" },
                                    { label: "Design", href: "#" },
                                    { label: "Business", href: "#" },
                                    { label: "Productivity", href: "#" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Blog Archive", href: "#" },
                                    { label: "Search Articles", href: "#" },
                                    { label: "Topic Guide", href: "#" },
                                    { label: "Subscribe", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#" },
                                    { label: "Contact", href: "#" },
                                    { label: "Careers", href: "#" },
                                    { label: "Media Kit", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Twitter", href: "#" },
                                    { label: "LinkedIn", href: "#" },
                                    { label: "GitHub", href: "#" },
                                    { label: "RSS Feed", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 BlogHub. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}