import React, { useState, useEffect, useRef } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { Element } from "react-scroll"; import { useTranslation } from "react-i18next"; import "../../../index.css"; import companyLogo from "../../../assets/REXNT.png"; const createStars = (count, config = {}) => Array.from({ length: count }).map((_, i) => ({ id: i, x: Math.random() * 100, y: Math.random() * 100, size: Math.random() * (config.maxSize || 3) + (config.minSize || 1), opacity: Math.random() * (config.maxOpacity || 0.8) + (config.minOpacity || 0.2), duration: Math.random() * (config.maxDuration || 10) + (config.minDuration || 5), delay: Math.random() * (config.maxDelay || 2), })); const Home = () => { const { t } = useTranslation(); const [showLogo, setShowLogo] = useState(false); const [showTagline, setShowTagline] = useState(false); const [scrollProgress, setScrollProgress] = useState(0); const homeRef = useRef(null); const stars = createStars(120); const backgroundStars = createStars(80, { minSize: 0.5, maxSize: 2, minOpacity: 0.1, maxOpacity: 0.5, }); useEffect(() => { const logoTimeout = setTimeout(() => setShowLogo(true), 500); const taglineTimeout = setTimeout(() => setShowTagline(true), 1500); const handleScroll = () => { if (homeRef.current) { const scrollPosition = window.scrollY; const windowHeight = window.innerHeight; const progress = Math.min(scrollPosition / (windowHeight * 0.2), 1); setScrollProgress(progress); } }; window.addEventListener("scroll", handleScroll); return () => { clearTimeout(logoTimeout); clearTimeout(taglineTimeout); window.removeEventListener("scroll", handleScroll); }; }, []); const AnimatedStars = () => ( <> {stars.map((star) => ( ))} ); const StaticStars = () => ( <> {backgroundStars.map((star) => (
))} ); return (
{showLogo && (
)}
{showTagline && (

شريكك الهندسي والتقني الرائد

في تنفيذ وإدارة المشاريع الصناعية والسكنية والنفطية

والمساهمة في تطوير البنية التحتية والقطاعات الإنتاجية عبر حلول حديثة ومستدامة

)}
); }; export default Home;