import { useSpring, animated } from "@react-spring/web"; import React, { useEffect, useRef, useState } from "react"; import { VscDebugBreakpointLog } from "react-icons/vsc"; import { useTranslation } from "react-i18next"; import "../css/Roadmap.css"; type Props = {}; const RoadMap = (props: Props) => { const [isVisible, setIsVisible] = useState(false); const { t } = useTranslation("roadmapHome"); const [roadMapData, setRoadmapData] = useState([]); useEffect(() => { setRoadmapData(t("array", { returnObjects: true })); const section = document.getElementById("roadmap"); const observer = new IntersectionObserver( ([entry]) => { setIsVisible(entry.isIntersecting); }, { threshold: 0.1 } ); if (!section) { return; } observer.observe(section); return () => { observer.unobserve(section); }; }, [t]); useEffect(() => { console.log("isVisible", isVisible); }, [isVisible]); const styles = useSpring({ opacity: isVisible ? 1 : 0, transform: isVisible ? "scaleX(1)" : "scaleX(0)", config: { duration: 500, }, }); const styles1 = useSpring({ opacity: isVisible ? 1 : 0, transform: isVisible ? "scaleY(1)" : "scaleY(0)", config: { duration: 500, }, }); return (
{listItem}