"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from "@/components/sections/blog/BlogCardThree";
import FooterCard from "@/components/sections/footer/FooterCard";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingInline from "@/components/navbar/NavbarLayoutFloatingInline";
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { Linkedin, Facebook, Instagram } from "lucide-react";

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="compact"
            sizing="largeSmallSizeMediumTitles"
            background="circleGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Unbroken Builders"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Projects", id: "projects" },
                            { name: "Services", id: "services" },
                            { name: "Testimonials", id: "testimonials" }
                        ]}
                        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">
                        <BlogCardThree
                            blogs={posts}
                            title="Construction Insights"
                            description="Expert tips and industry insights from our construction professionals"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Unbroken Builders"
                        copyrightText="© 2024 Unbroken Builders. All rights reserved. Las Vegas, Nevada."
                        socialLinks={[
                            {
                                icon: Linkedin,
                                href: "https://linkedin.com/company/unbroken-builders",                                ariaLabel: "LinkedIn"
                            },
                            {
                                icon: Facebook,
                                href: "https://facebook.com/unbrokenbuilders",                                ariaLabel: "Facebook"
                            },
                            {
                                icon: Instagram,
                                href: "https://instagram.com/unbrokenbuilders",                                ariaLabel: "Instagram"
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}