"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBaseCard from "@/components/sections/footer/FooterBaseCard";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleCentered from "@/components/navbar/NavbarStyleCentered/NavbarStyleCentered";
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="mediumSmall"
            sizing="largeSizeMediumTitles"
            background="aurora"
            cardStyle="gradient-bordered"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="SocialHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Profile", id: "profile" },
                            { name: "Posts", id: "posts" },
                            { name: "Stories", id: "stories" },
                            { name: "Community", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Follow", 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">
                        <BlogCardOne
                            blogs={posts}
                            title="Creator Content Hub"
                            description="Discover inspiring stories, tips, and insights from the creative community"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Content"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="SocialHub"
                        columns={[
                            {
                                title: "Social",                                items: [
                                    { label: "Instagram", href: "#" },
                                    { label: "TikTok", href: "#" },
                                    { label: "YouTube", href: "#" }
                                ]
                            },
                            {
                                title: "Content",                                items: [
                                    { label: "Blog", href: "#" },
                                    { label: "Guides", href: "#" },
                                    { label: "Resources", href: "#" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Discord", href: "#" },
                                    { label: "Forums", href: "#" },
                                    { label: "Newsletter", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 SocialHub | Content Creator Platform"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}