"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 NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import { Instagram, Twitter, Linkedin } from 'lucide-react';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="smallMedium"
            sizing="largeSmall"
            background="aurora"
            cardStyle="gradient-radial"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="ProfileHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Explore", id: "explore" },
                            { name: "Messages", id: "messages" },
                            { name: "Notifications", id: "notifications" },
                            { name: "Profile", id: "profile" },
                            { name: "Settings", id: "settings" }
                        ]}
                    />
                </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="Explore our latest insights and stories"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

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