"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, Instagram, Facebook } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="largeSmall"
            background="blurBottom"
            cardStyle="elevated"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="layered"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="San Francisco"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Attractions", id: "attractions" },
                            { name: "Neighborhoods", id: "neighborhoods" },
                            { name: "Blog", id: "blog" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Explore the Bay"
                        bottomRightText="hello@sf-guide.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="San Francisco Stories"
                            description="Discover the latest insights, guides, and hidden gems from the City by the Bay"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="San Francisco Guide"
                        copyrightText="© 2025 San Francisco Travel Guide. All rights reserved. Exploring the magic of SF."
                        socialLinks={[
                            { icon: Twitter, href: "https://twitter.com/sfguide", ariaLabel: "Twitter" },
                            { icon: Instagram, href: "https://instagram.com/sfguide", ariaLabel: "Instagram" },
                            { icon: Facebook, href: "https://facebook.com/sfguide", ariaLabel: "Facebook" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}