"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
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, Twitter, Mail } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="largeSmall"
            background="fluid"
            cardStyle="layered-gradient"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="The Soap Shop"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "FAQ", id: "faq" }
                        ]}
                        button={{ text: "Contact", href: "#contact" }}
                        className="bg-background/80 backdrop-blur-md border border-accent/10"
                        navItemClassName="text-foreground hover:text-accent transition-colors"
                        buttonClassName="bg-primary-cta hover:bg-primary-cta/90"
                        buttonTextClassName="text-primary-cta-text font-medium"
                    />
                </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}
                            title="The Soap Shop Blog"
                            description="Discover the art of natural soap making, ingredient insights, and wellness tips from our artisan team"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tagAnimation="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="The Soap Shop"
                        copyrightText="© 2025 The Soap Shop. Small-batch organic soap bars."
                        socialLinks={[
                            { icon: Instagram, href: "https://instagram.com/thesoapshop", ariaLabel: "Instagram" },
                            { icon: Twitter, href: "https://twitter.com/thesoapshop", ariaLabel: "Twitter" },
                            { icon: Mail, href: "mailto:hello@thesoapshop.com", ariaLabel: "Email" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}