"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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="directional-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="largeSmall"
            background="circleGradient"
            cardStyle="outline"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Gonzales Flooring"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Projects", id: "projects" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Get Free Estimate", 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">
                        <BlogCardThree
                            blogs={posts}
                            title="Flooring Insights & Updates"
                            description="Explore expert tips, project showcases, and the latest trends in flooring solutions for Iowa City homes and businesses."
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Hardwood Flooring", href: "services" },
                                    { label: "Laminate & Vinyl", href: "services" },
                                    { label: "Tile Flooring", href: "services" },
                                    { label: "Free Estimates", href: "contact" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Projects", href: "projects" },
                                    { label: "Contact", href: "contact" },
                                    { label: "Local Community", href: "about" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Iowa City, IA", href: "#" },
                                    { label: "Get a Free Estimate", href: "contact" },
                                    { label: "Mon-Fri: 8AM-5PM", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2024 Gonzales Flooring. Local flooring solutions for Iowa City."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}