"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="compact"
            sizing="largeSmallSizeMediumTitles"
            background="none"
            cardStyle="glass-elevated"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="ShopHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Reviews", id: "reviews" },
                            { name: "Contact", id: "contact" },
                            { name: "FAQ", id: "faq" }
                        ]}
                        button={{ text: "Shop 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="ShopHub Blog"
                            description="Discover the latest trends, tips, and insights for premium e-commerce experiences"
                            tag="Featured"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="ShopHub"
                        copyrightText="© 2025 ShopHub. All rights reserved. Premium e-commerce experiences."
                        socialLinks={[
                            { icon: Facebook, href: "https://facebook.com/shophub", ariaLabel: "ShopHub Facebook" },
                            { icon: Twitter, href: "https://twitter.com/shophub", ariaLabel: "ShopHub Twitter" },
                            { icon: Instagram, href: "https://instagram.com/shophub", ariaLabel: "ShopHub Instagram" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}