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

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

    return (
        <ThemeProvider
            defaultButtonVariant="icon-arrow"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="medium"
            sizing="medium"
            background="aurora"
            cardStyle="layered-gradient"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Textbooked"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "How It Works", id: "process" },
                            { name: "Impact", id: "metrics" },
                            { name: "Testimonials", id: "testimonials" }
                        ]}
                        button={{ text: "Start Learning", href: "#contact" }}
                    />
                </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="Featured Articles"
                            description="Discover insights and knowledge that transform learning experiences"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Learning Hub"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Textbooked"
                        copyrightText="© 2025 Textbooked. Built for serious learners."
                        socialLinks={[
                            { icon: Linkedin, href: "https://linkedin.com", ariaLabel: "LinkedIn" },
                            { icon: Twitter, href: "https://twitter.com", ariaLabel: "Twitter" },
                            { icon: Github, href: "https://github.com", ariaLabel: "GitHub" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}