import { Box, Container, Image, Text } from "@chakra-ui/react"; import React, { useEffect, useRef, useState } from "react"; import patter1 from "../assets/asset3.png"; import patter2 from "../assets/asset1.png"; import cellFrame from "../assets/cellFrame.png"; import cellScreen1 from "../assets/cellScreen1.png"; import cellScreen2 from "../assets/cellScreen2.png"; // import cellScreen3 from "../assets/cellScreen3.png"; const HowItWorks = () => { const [spanHeight, setSpanHeight] = useState(25); const intervalRef = useRef(null); // Use ref to store interval ID useEffect(() => { intervalRef.current = setInterval(() => { setSpanHeight((prevHeight) => (prevHeight >= 100 ? 25 : prevHeight + 25)); }, 3000); return () => clearInterval(intervalRef.current); // Clean up the interval on component unmount }, []); const handleBoxClick = (index) => { const newHeight = (index + 1) * 25; setSpanHeight(newHeight); clearInterval(intervalRef.current); // Clear the interval when a box is clicked }; return ( How does it work? handleBoxClick(0)} p={12} pt={4} pb={2}> Sign-up Create an account with Tanami and get approved in under 10 minutes. handleBoxClick(1)} p={12} pt={4} pb={2}> Browse Select from top-tier funds approved on the Tanami platform. handleBoxClick(2)} p={12} pt={4} pb={2}> Invest Fund investments using a bank transfer, debit or credit card. handleBoxClick(3)} p={12} pt={4} pb={2}> Monitor Stay up to date with the performance of your investment portfolio, live on the app. ); }; export default HowItWorks;