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

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="compact"
            sizing="large"
            background="none"
            cardStyle="soft-shadow"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Portfolio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Projects", id: "projects" },
                            { name: "Skills", id: "skills" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "Get Started",                            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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Articles"
                            description="Stay updated with our latest insights and stories"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Portfolio"
                        copyrightText="© 2025 | Creative Portfolio. All rights reserved."
                        socialLinks={[
                            {
                                icon: Linkedin,
                                href: "https://linkedin.com",                                ariaLabel: "LinkedIn"
                            },
                            {
                                icon: Github,
                                href: "https://github.com",                                ariaLabel: "GitHub"
                            },
                            {
                                icon: Twitter,
                                href: "https://twitter.com",                                ariaLabel: "Twitter"
                            },
                            {
                                icon: Mail,
                                href: "mailto:hello@portfolio.com",                                ariaLabel: "Email"
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}