"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterLogoReveal from "@/components/sections/footer/FooterLogoReveal";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingOverlay from "@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay";
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { BookOpen } from "lucide-react";

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="mediumLargeSizeLargeTitles"
            background="circleGradient"
            cardStyle="solid"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="PropertyHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Browse", id: "listings" },
                            { name: "About", id: "about" },
                            { name: "Featured", id: "featured" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "List Property", 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">
                        <BlogCardOne
                            blogs={posts}
                            title="Property Insights"
                            description="Stay informed with the latest real estate trends, market updates, and expert insights from PropertyHub"
                            tag="Blog"
                            tagIcon={BookOpen}
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoReveal
                        logoText="PropertyHub"
                        leftLink={{ text: "Privacy Policy", href: "https://example.com/privacy" }}
                        rightLink={{ text: "Terms of Service", href: "https://example.com/terms" }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}