"use client"; import { useEffect, useRef, useCallback, useState } from "react"; import Link from "next/link"; import gsap from "gsap"; function useGridSize() { const [gridSize, setGridSize] = useState({ cols: 20, rows: 12 }); useEffect(() => { const updateGridSize = () => { const width = window.innerWidth; if (width < 640) { // Mobile setGridSize({ cols: 8, rows: 10 }); } else if (width < 1024) { // Tablet setGridSize({ cols: 12, rows: 10 }); } else { // Desktop setGridSize({ cols: 20, rows: 12 }); } }; updateGridSize(); window.addEventListener("resize", updateGridSize); return () => window.removeEventListener("resize", updateGridSize); }, []); return gridSize; } function TileGrid() { const gridRef = useRef(null); const tilesRef = useRef<(HTMLDivElement | null)[]>([]); const { cols, rows } = useGridSize(); const handleMouseEnter = useCallback((index: number) => { const tile = tilesRef.current[index]; if (tile) { gsap.killTweensOf(tile); gsap.to(tile, { rotateY: 180, duration: 0.5, ease: "power2.inOut", overwrite: true, }); } }, []); const handleMouseLeave = useCallback((index: number) => { const tile = tilesRef.current[index]; if (tile) { gsap.killTweensOf(tile); gsap.to(tile, { rotateY: 0, duration: 0.5, ease: "power2.inOut", overwrite: true, }); } }, []); // Reset refs array when grid size changes useEffect(() => { tilesRef.current = []; }, [cols, rows]); return (
{Array.from({ length: cols * rows }).map((_, index) => (
handleMouseEnter(index)} onMouseLeave={() => handleMouseLeave(index)} className="cursor-pointer" style={{ perspective: "500px" }} >
{ tilesRef.current[index] = el; }} className="w-full h-full relative" style={{ transformStyle: "preserve-3d", willChange: "transform", }} > {/* Front - Black */}
{/* Back - White */}
))}
); } export default function Hero() { const headingRef = useRef(null); const contentRef = useRef(null); useEffect(() => { // Animate heading on mount if (headingRef.current) { gsap.fromTo( headingRef.current, { opacity: 0, y: 50 }, { opacity: 1, y: 0, duration: 1, ease: "power3.out", delay: 0.3 } ); } if (contentRef.current) { gsap.fromTo( contentRef.current.children, { opacity: 0, y: 30 }, { opacity: 1, y: 0, duration: 0.8, stagger: 0.15, ease: "power3.out", delay: 0.5 } ); } }, []); return (
{/* Tile Grid Background */}
{/* Center Content */}
FEBRUARY 2026

UNLEASH YOUR ART

From canvas to screen, showcase your creativity and let your artwork speak to the world.

JOIN COMPETITION EXPLORE GALLERY
{/* Scroll Indicator */}
Scroll
{/* Bottom Marquee */}
{Array(8) .fill(null) .map((_, i) => (
ArtSplash SJEC 2026
))}
); }