import React, { useEffect, useRef, useState } from 'react'; import { ArrowRight, Star, Users, Venus, Heart, PenTool, MoveRight } from 'lucide-react'; import { Reveal } from './Reveal'; interface HomeProps { t: any; } const ScribbleStar = ({ className }: { className?: string }) => ( ); export const Home: React.FC = ({ t }) => { // Refs for Scroll Animations const heroRef = useRef(null); const heroTextTopRef = useRef(null); const heroTextBottomRef = useRef(null); const heroImageRef = useRef(null); const horizontalSectionRef = useRef(null); const horizontalTrackRef = useRef(null); const newsRef = useRef(null); // State for horizontal scroll calculation const [scrollProgress, setScrollProgress] = useState(0); useEffect(() => { const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)'); if (mediaQuery.matches) return; let rafId: number; const handleScroll = () => { const scrollY = window.scrollY; const viewportHeight = window.innerHeight; rafId = requestAnimationFrame(() => { // --- HERO ANIMATION --- if (heroRef.current && heroTextTopRef.current && heroTextBottomRef.current && heroImageRef.current) { const heroProgress = Math.min(scrollY / viewportHeight, 1); heroTextTopRef.current.style.transform = `translateX(-${heroProgress * 30}vw) rotate(-2deg)`; heroTextBottomRef.current.style.transform = `translateX(${heroProgress * 30}vw) rotate(2deg)`; heroImageRef.current.style.transform = `translateY(${heroProgress * 50}px) rotate(${heroProgress * 5}deg)`; } // --- HORIZONTAL SCROLL CALCULATION --- if (horizontalSectionRef.current && horizontalTrackRef.current) { const sectionTop = horizontalSectionRef.current.offsetTop; const sectionHeight = horizontalSectionRef.current.offsetHeight; const scrollDistanceFromTop = scrollY - sectionTop; let progress = scrollDistanceFromTop / (sectionHeight - viewportHeight); progress = Math.max(0, Math.min(progress, 1)); setScrollProgress(progress); } }); }; window.addEventListener('scroll', handleScroll, { passive: true }); return () => { window.removeEventListener('scroll', handleScroll); cancelAnimationFrame(rafId); }; }, []); // Update Horizontal Transform useEffect(() => { if (horizontalTrackRef.current) { const trackWidth = horizontalTrackRef.current.scrollWidth; const viewportWidth = window.innerWidth; const maxTranslate = trackWidth - viewportWidth; if (maxTranslate > 0) { horizontalTrackRef.current.style.transform = `translateX(-${scrollProgress * maxTranslate}px)`; } } }, [scrollProgress]); const newsImages = [ { image: "https://images.unsplash.com/photo-1596700813955-442436d423e0?auto=format&fit=crop&q=80&w=600", height: "h-96" }, { image: "https://images.unsplash.com/photo-1572691242698-b7f3001844b2?auto=format&fit=crop&q=80&w=600", height: "h-[32rem]" } ]; const currentNewsItems = t.news.items.map((item: any, index: number) => ({ ...item, ...newsImages[index] })); return ( <> {/* --- HERO SECTION --- */} {t.hero.est} {t.hero.women} {t.hero.future} {t.hero.scroll} {/* --- MARQUEE BANNER --- */} {[...Array(2)].map((_, groupIndex) => ( {[...Array(8)].map((_, i) => ( {t.marquee} ))} ))} {/* --- HORIZONTAL SCROLL SECTION --- */} {t.values.title} {t.values.cards.map((card: any, idx: number) => ( {idx === 0 && } {idx === 1 && } {idx === 2 && } #{card.id} {card.title} {card.desc} ))} {/* --- NEWS SECTION --- */} {t.news.header} {t.news.year} {currentNewsItems.map((item: any, idx: number) => ( {item.category} {item.date} {item.title} ))} {t.news.sticky.title_1}{t.news.sticky.title_2} {t.news.sticky.desc} {t.news.sticky.btn} {t.news.secondary.category} {t.news.secondary.title} {/* --- NEWSLETTER SECTION --- */} {t.newsletter.title_1}{t.newsletter.title_2} {t.newsletter.desc} > ); };
{card.desc}
{t.news.sticky.desc}
{t.newsletter.desc}