"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterSimple from "@/components/sections/footer/FooterSimple";
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="hover-magnetic"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="small"
            sizing="mediumLargeSizeLargeTitles"
            background="none"
            cardStyle="gradient-radial"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Portfolio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Projects", id: "projects" },
                            { 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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Articles"
                            description="Discover insights, tutorials, and updates from our development journey"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigation",                                items: [
                                    { label: "Home", href: "/" },
                                    { label: "About", href: "#about" },
                                    { label: "Projects", href: "#projects" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Social",                                items: [
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "GitHub", href: "https://github.com" },
                                    { label: "Dribbble", href: "https://dribbble.com" },
                                    { label: "Twitter", href: "https://twitter.com" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "/privacy" },
                                    { label: "Terms of Service", href: "/terms" },
                                    { label: "Cookie Policy", href: "/cookies" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Portfolio. All rights reserved."
                        bottomRightText="Designed & Developed with care"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}