"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="hover-bubble"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="medium"
            sizing="largeSmallSizeLargeTitles"
            background="circleGradient"
            cardStyle="solid"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Portfolio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Work", id: "work" },
                            { name: "Impact", id: "metrics" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Get in Touch", href: "#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="Latest Articles & Insights"
                            description="Explore our comprehensive collection of thoughts, tutorials, and industry insights from our team of experts"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/workplace-with-laptop_23-2147651756.jpg"
                        imageAlt="Creative workspace and professional studio"
                        columns={[
                            {
                                title: "Navigation",                                items: [
                                    { label: "Home", href: "#" },
                                    { label: "About", href: "#about" },
                                    { label: "Work", href: "#work" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Web Design", href: "#" },
                                    { label: "UX/UI Design", href: "#" },
                                    { label: "Branding", href: "#" },
                                    { label: "Consulting", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "LinkedIn", href: "#" },
                                    { label: "Twitter", href: "#" },
                                    { label: "Dribbble", href: "#" },
                                    { label: "Email", href: "#" }
                                ]
                            }
                        ]}
                        logoText="Portfolio"
                        copyrightText="© 2025 | All Rights Reserved"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}