"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="mediumSmall"
            sizing="medium"
            background="noise"
            cardStyle="gradient-radial"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Portfolio", id: "portfolio" },
                            { name: "About", id: "about" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "contact" },
                        ]}
                        brandName="ZN Wall Designs, LLC"
                        button={{ text: "Get a Quote", 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"
                            description="Insights and updates from our team"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Wallpaper Installation", href: "#features" },
                                    { label: "Interior Painting", href: "#features" },
                                    { label: "Wall Repair", href: "#features" },
                                ],
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Portfolio", href: "#portfolio" },
                                    { label: "Contact", href: "#contact" },
                                ],
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "FAQ", href: "#faq" },
                                    { label: "Privacy Policy", href: "/privacy" },
                                    { label: "Terms of Service", href: "/terms" },
                                ],
                            },
                        ]}
                        bottomLeftText="© 2024 ZN Wall Designs, LLC. All rights reserved."
                        bottomRightText="Designed with passion"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
