"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 NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { Instagram, Facebook, Linkedin } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="compact"
            sizing="medium"
            background="fluid"
            cardStyle="soft-shadow"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Milano Atelier"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Collections", id: "collections" },
                            { name: "About", id: "about" },
                            { name: "Craft", id: "features" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Shop Now", href: "collections" }}
                    />
                </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="Milano Atelier Insights"
                            description="Discover the artistry, craftsmanship, and stories behind our exquisite Milano collections"
                            tag="Journal"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tagAnimation="slide-up"
                            buttonAnimation="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Milano Atelier"
                        copyrightText="© 2025 Milano Atelier | Crafted with Excellence in Milan"
                        socialLinks={[
                            { icon: Instagram, href: "https://instagram.com/milanog-atelier", ariaLabel: "Instagram" },
                            { icon: Facebook, href: "https://facebook.com/milanog-atelier", ariaLabel: "Facebook" },
                            { icon: Linkedin, href: "https://linkedin.com/company/milano-atelier", ariaLabel: "LinkedIn" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}