"use client"; import { BackgroundEffects } from "@/components/layout"; import { CategoryFilters, TutorialsGrid, type Category, } from "@/components/tutorials"; import { HeroSection } from "@/components/ui"; import type { Tutorial } from "@/lib/tutorials"; import gsap from "gsap"; import { useEffect, useRef } from "react"; interface HomeContentProps { tutorials: Tutorial[]; categories: Category[]; allTutorialsCount: number; } export function HomeContent({ tutorials, categories, allTutorialsCount, }: HomeContentProps) { const containerRef = useRef(null); const heroRef = useRef(null); const filtersRef = useRef(null); const gridRef = useRef(null); useEffect(() => { const ctx = gsap.context(() => { const tl = gsap.timeline({ defaults: { ease: "power3.out" } }); // Hero section fade in + slide up tl.fromTo( heroRef.current, { y: 60, opacity: 0 }, { y: 0, opacity: 1, duration: 0.8 } ); // Filters stagger in tl.fromTo( filtersRef.current, { y: 30, opacity: 0 }, { y: 0, opacity: 1, duration: 0.6 }, "-=0.4" ); // Grid cards stagger in const cards = gridRef.current?.querySelectorAll("article"); if (cards && cards.length > 0) { tl.fromTo( cards, { y: 50, opacity: 0, scale: 0.95 }, { y: 0, opacity: 1, scale: 1, duration: 0.6, stagger: 0.15, ease: "back.out(1.2)", }, "-=0.3" ); } }, containerRef); return () => ctx.revert(); }, [tutorials]); return (
); }