"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 NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { Twitter, Facebook, Instagram, Linkedin } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="elastic-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="smallMedium"
            sizing="largeSmallSizeMediumTitles"
            background="aurora"
            cardStyle="glass-elevated"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingInline
                        brandName="Apple iPhone"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Support", id: "faq" }
                        ]}
                        button={{ text: "Shop Now", href: "products" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest iPhone News"
                            description="Stay updated with the latest Apple iPhone insights, features, and technology breakthroughs"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="iPhone Blog"
                        />
                    )}

                    <FooterCard
                        logoText="Apple iPhone"
                        copyrightText="© 2025 Apple Inc. All rights reserved. | Premium Mobile Experience"
                        socialLinks={[
                            { icon: Twitter, href: "https://twitter.com/apple", ariaLabel: "Twitter" },
                            { icon: Facebook, href: "https://facebook.com/apple", ariaLabel: "Facebook" },
                            { icon: Instagram, href: "https://instagram.com/apple", ariaLabel: "Instagram" },
                            { icon: Linkedin, href: "https://linkedin.com/company/apple", ariaLabel: "LinkedIn" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}