"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterBase from '@/components/sections/footer/FooterBase';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="largeSmallSizeMediumTitles"
            background="floatingGradient"
            cardStyle="soft-shadow"
            primaryButtonStyle="flat"
            secondaryButtonStyle="solid"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Portfolio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Projects", id: "projects" },
                            { name: "Skills", id: "metrics" },
                            { name: "Contact", id: "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 thoughts on technology, design, and development"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="Portfolio"
                        copyrightText="© 2024 My Portfolio. All rights reserved."
                        columns={[
                            {
                                title: "Navigation",                                items: [
                                    { label: "Home", href: "/" },
                                    { label: "Projects", href: "projects" },
                                    { label: "About", href: "about" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                title: "Social",                                items: [
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "Dribbble", href: "https://dribbble.com" },
                                    { label: "Instagram", href: "https://instagram.com" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Blog", href: "https://example.com/blog" },
                                    { label: "Case Studies", href: "https://example.com/case-studies" },
                                    { label: "Resume", href: "https://example.com/resume.pdf" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}