"use client";

import ReactLenis from "lenis/react";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import { useBlogPosts } from "@/hooks/useBlogPosts";
import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="mediumLargeSizeLargeTitles"
            background="floatingGradient"
            cardStyle="glass-elevated"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                  <NavbarStyleFullscreen
                      navItems={[
                          { name: "Home", id: "/" },
                          { name: "Blog", id: "/blog" },
                          { name: "Shop", id: "/shop" },
                      ]}
                      brandName="DigitalEdge"
                      bottomLeftText="Innovation in Digital"
                      bottomRightText="info@digitaledge.com"
                  />
                </div>

                {isLoading ? (
                    <div className="w-content-width mx-auto py-20 text-center">
                        <p className="text-foreground">Loading posts...</p>
                    </div>
                ) : (
                    <BlogCardThree
                        blogs={posts}
                        title="Featured Articles"
                        description="Explore our latest insights"
                        animationType="slide-up"
                        textboxLayout="default"
                        useInvertedBackground={false}
                    />
                )}

                <div id="footer" data-section="footer">
                  <FooterLogoEmphasis
                      columns={[
                          {
                              items: [
                                  { label: "Home", href: "/" },
                                  { label: "Services", href: "/#features" },
                                  { label: "About Us", href: "/#about" },
                              ],
                          },
                          {
                              items: [
                                  { label: "Clients", href: "/#social-proof" },
                                  { label: "Testimonials", href: "/#testimonials" },
                                  { label: "Contact", href: "/#contact" },
                              ],
                          },
                      ]}
                      logoText="DigitalEdge"
                  />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
