"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="large"
            background="grid"
            cardStyle="glass-elevated"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Hero", id: "/#hero-section" },
                            { name: "About", id: "/#about-section" },
                            { name: "Feature", id: "/#features-section" },
                            { name: "Product", id: "/#products-section" },
                            { name: "Testimonial", id: "/#testimonials-section" },
                            { name: "Contact", id: "/#contact-section" },
                        ]}
                        brandName="Klark"
                        bottomLeftText="Global Community"
                        bottomRightText="hello@example.com"
                        topBarClassName=""
                    />
                </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}
                                animationType="slide-up"
                                title="Latest Articles"
                                description="Insights and updates from our team"
                                textboxLayout="default"
                                useInvertedBackground={false}
                                tag="Blog"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                       <FooterCard
                          logoText="Klark Floral Studio"
                          copyrightText="© 2025 | Klark Floral Studio"
                          socialLinks={[
                            { icon: Instagram, href: "https://www.instagram.com/klarkfloralstudio", ariaLabel: "Follow us on Instagram" },
                            { icon: Twitter, href: "https://twitter.com/klarkfloralstudio", ariaLabel: "Follow us on Twitter" },
                            { icon: Facebook, href: "https://www.facebook.com/klarkfloralstudio", ariaLabel: "Like us on Facebook" },
                          ]}
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
