"use client";

import ReactLenis from "lenis/react";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import { useBlogPosts } from "@/hooks/useBlogPosts";

import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';

import BlogCardThree from '@/components/sections/blog/BlogCardThree';

import FooterCard from '@/components/sections/footer/FooterCard';
import { Twitter, Linkedin, Instagram } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="icon-arrow"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="medium"
            sizing="medium"
            background="aurora"
            cardStyle="layered-gradient"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <NavbarLayoutFloatingInline
                    navItems={[
                        { name: "Home", id: "/" },
                        { name: "About", id: "#about" },
                        { name: "Services", id: "#features-detailed" },
                        { name: "Clients", id: "/" },
                        { name: "Contact", id: "#contact" },
                    ]}
                    brandName="Pro Studio"
                    button={{ text: "Get a Quote", href: "/#contact" }}
                    className="bg-card/90 backdrop-blur-sm shadow-lg"
                    navItemClassName="text-foreground hover:text-primary-cta transition-colors duration-300"
                    buttonClassName="bg-primary-cta text-secondary-cta px-6 py-2 rounded-pill hover:bg-accent hover:text-primary-cta transition-all duration-300"
                    buttonTextClassName="font-medium text-base"
                />

                {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}
                    />
                )}

                <FooterCard
                    logoText="Pro Studio"
                    copyrightText="© 2023 Pro Studio. All rights reserved."
                    socialLinks={[
                        { icon: Twitter, href: "https://twitter.com/prostudio", ariaLabel: "Twitter" },
                        { icon: Linkedin, href: "https://linkedin.com/company/prostudio", ariaLabel: "LinkedIn" },
                        { icon: Instagram, href: "https://instagram.com/prostudio", ariaLabel: "Instagram" },
                    ]}
                    className="py-16 md:py-24 bg-background-accent"
                    cardClassName="bg-card/70 backdrop-blur-md"
                    logoClassName="text-2xl font-bold text-foreground"
                    copyrightTextClassName="text-sm text-foreground/70"
                    socialIconClassName="text-foreground/80 hover:text-primary-cta transition-colors duration-300"
                />
            </ReactLenis>
        </ThemeProvider>
    );
}
