"use client";

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

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

    const footerSocialLinks = [
        { icon: Instagram, href: "https://instagram.com/pawhaven", ariaLabel: "Instagram" },
        { icon: Facebook, href: "https://facebook.com/pawhaven", ariaLabel: "Facebook" },
        { icon: Twitter, href: "https://twitter.com/pawhaven", ariaLabel: "Twitter" },
    ];

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="mediumLarge"
            sizing="large"
            background="fluid"
            cardStyle="soft-shadow"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Paw Haven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Adopt", id: "/#adopt" },
                            { name: "About", id: "/#about" },
                            { name: "Success", id: "/#testimonials" },
                            { name: "Support", id: "/#support" },
                            { name: "Blog", id: "/blog" },
                            { name: "Shop", id: "/shop" },
                            { name: "Contact", id: "/#contact" }
                        ]}
                        button={{ text: "Donate", 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="Featured Articles"
                            description="Explore our latest insights"
                            animationType="slide-up"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Paw Haven"
                        copyrightText="© 2024 Paw Haven. All rights reserved."
                        socialLinks={footerSocialLinks}
                        ariaLabel="Paw Haven Footer"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
