"use client"; import React, { useEffect, useRef, useState } from "react"; import Link from "next/link"; import gsap from "gsap"; import { ShimmerText } from "@/animations/Reveal"; export default function WingsHero() { const [activeSlide, setActiveSlide] = useState(0); const containerRef = useRef(null); useEffect(() => { const interval = setInterval(() => { setActiveSlide((prev) => (prev === 0 ? 1 : 0)); }, 7000); return () => clearInterval(interval); }, []); useEffect(() => { if (!containerRef.current) return; const activeItem = containerRef.current.querySelector(".owl-item.active"); if (!activeItem) return; const heading = activeItem.querySelector(".heading-content"); const text = activeItem.querySelector(".text-content"); const actions = activeItem.querySelector(".wings-hero-actions"); const animatedEls = [heading, text, actions].filter(Boolean); if (!animatedEls.length) return; gsap.killTweensOf(animatedEls); if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) { gsap.set(animatedEls, { y: 0, opacity: 1, scale: 1 }); return; } if (heading) { gsap.fromTo( heading, { y: 55, opacity: 0, scale: 0.95 }, { y: 0, opacity: 1, scale: 1, duration: 1.1, ease: "power4.out" } ); } if (text) { gsap.fromTo( text, { y: 30, opacity: 0 }, { y: 0, opacity: 1, duration: 0.95, ease: "power3.out", delay: 0.25 } ); } if (actions) { gsap.fromTo( actions, { y: 24, opacity: 0 }, { y: 0, opacity: 1, duration: 0.85, ease: "power3.out", delay: 0.38 } ); } }, [activeSlide]); const handleDotClick = (index: number) => { setActiveSlide(index); }; const toggleSlide = () => { setActiveSlide((prev) => (prev === 0 ? 1 : 0)); }; return ( <>