import React, { useRef, useEffect } from 'react'; import { useScroll } from 'framer-motion'; const api_url = process.env.REACT_APP_API_URL; const HRProcess = ({ data }) => { //console.log(data); const ref = useRef(null); const { scrollYProgress } = useScroll({ container: ref }); useEffect(() => { const imageArray = document.querySelectorAll('.image-switch'); //console.log(imageArray); const switchImage = scrollYProgress.onChange(value => { if (value <= 0.1) { imageArray.forEach(el => el.classList.remove('active-image')); imageArray[0].classList.add('active-image'); } if (value > 0.1) { imageArray.forEach(el => el.classList.remove('active-image')); imageArray[1].classList.add('active-image'); } if (value > 0.4) { imageArray.forEach(el => el.classList.remove('active-image')); imageArray[2].classList.add('active-image'); } if (value > 0.6) { imageArray.forEach(el => el.classList.remove('active-image')); imageArray[3].classList.add('active-image'); } if (value > 0.8) { imageArray.forEach(el => el.classList.remove('active-image')); imageArray[4].classList.add('active-image'); } }); return () => { switchImage(); }; }); return (
{/* Dynamic Image */} {data.selection_process.steps.map((item, index) => ( ))}
{data.selection_process.steps.map((item, index) => ( <> {/* Section */}
{/* Line */}
{/* Dot */}

{item.heading}

{item.paragraph}

{item.cto != null && ( )}
))}
); }; export default HRProcess;