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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="mediumSmall"
            sizing="largeSmallSizeMediumTitles"
            background="none"
            cardStyle="outline"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Portfolio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Work", id: "gallery" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "Get in Touch",                            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="Explore our latest insights and creative work"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

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