"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="small"
            sizing="largeSmallSizeMediumTitles"
            background="none"
            cardStyle="glass-depth"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="Chronicles"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Articles", id: "blog" },
                            { name: "Categories", id: "categories" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Thoughtful Writing"
                        bottomRightText="hello@chronicles.com"
                    />
                </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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Chronicles"
                            description="Discover thoughtful writing on technology, culture, and innovation from our expert contributors"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Articles"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Chronicles"
                        copyrightText="© 2025 Chronicles. All rights reserved."
                        socialLinks={[
                            { icon: Twitter, href: "https://twitter.com/chronicles", ariaLabel: "Twitter" },
                            { icon: Linkedin, href: "https://linkedin.com/company/chronicles", ariaLabel: "LinkedIn" },
                            { icon: Instagram, href: "https://instagram.com/chronicles", ariaLabel: "Instagram" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}