"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 { Instagram, Facebook, Twitter } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="largeSmallSizeLargeTitles"
            background="aurora"
            cardStyle="glass-elevated"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Bean Haven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Menu", id: "products" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Order Now", href: "products" }}
                    />
                </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="Coffee Chronicles"
                            description="Discover the stories behind every cup, from bean to brew, and explore our journey in crafting exceptional coffee experiences"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Bean Haven"
                        copyrightText="© 2025 Bean Haven Coffee Co. All rights reserved."
                        socialLinks={[
                            { icon: Instagram, href: "https://instagram.com/beanhaven", ariaLabel: "Instagram" },
                            { icon: Facebook, href: "https://facebook.com/beanhaven", ariaLabel: "Facebook" },
                            { icon: Twitter, href: "https://twitter.com/beanhaven", ariaLabel: "Twitter" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}