"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterCard from '@/components/sections/footer/FooterCard';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { Twitter, Linkedin, Github } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="small"
            sizing="largeSmallSizeLargeTitles"
            background="floatingGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="Dashboard"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Overview", id: "overview" },
                            { name: "Analytics", id: "analytics" },
                            { name: "Reports", id: "reports" },
                            { name: "Settings", id: "settings" }
                        ]}
                        bottomLeftText="Dashboard v1.0"
                        bottomRightText="admin@dashboard.com"
                    />
                </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 Dashboard Articles"
                            description="Insights and analytics updates from our team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Dashboard"
                        copyrightText="© 2025 Dashboard Analytics. All rights reserved."
                        socialLinks={[
                            { icon: Twitter, href: "https://twitter.com", ariaLabel: "Twitter" },
                            { icon: Linkedin, href: "https://linkedin.com", ariaLabel: "LinkedIn" },
                            { icon: Github, href: "https://github.com", ariaLabel: "GitHub" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}