"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="bounce-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="compact"
            sizing="mediumLargeSizeMediumTitles"
            background="none"
            cardStyle="layered-gradient"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="Safe Haven Shelter"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Available Pets", id: "available" },
                            { name: "Adopt", id: "adopt" },
                            { name: "Stories", id: "stories" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Love saves lives"
                        bottomRightText="contact@safehaven.org"
                    />
                </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="Pet Care & Adoption Stories"
                            description="Stay updated with our latest insights on pet care, adoption success stories, and shelter news"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/elegant-fashion-girls-summer-park_1157-21448.jpg"
                        imageAlt="Happy rescued animals"
                        logoText="Safe Haven Shelter"
                        copyrightText="© 2024 Safe Haven Shelter. Saving lives, one pet at a time."
                        columns={[
                            {
                                title: "Adopt",                                items: [
                                    { label: "Available Pets", href: "available" },
                                    { label: "Adoption Process", href: "adopt" },
                                    { label: "Success Stories", href: "stories" }
                                ]
                            },
                            {
                                title: "Get Involved",                                items: [
                                    { label: "Volunteer", href: "volunteers" },
                                    { label: "Donate", href: "#" },
                                    { label: "Sponsor", href: "#" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "About Us", href: "#" },
                                    { label: "Email Us", href: "mailto:contact@safehaven.org" },
                                    { label: "Visit Us", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}