|
|
|
@@ -1,91 +1,132 @@ |
|
|
|
import React, {useRef, useEffect} from 'react'; |
|
|
|
import React, { useRef, useEffect } from 'react'; |
|
|
|
import { useScroll } from 'framer-motion'; |
|
|
|
|
|
|
|
const HRProcess = ({data, img}) => { |
|
|
|
console.log(data); |
|
|
|
const api_url = process.env.REACT_APP_API_URL; |
|
|
|
|
|
|
|
const ref = useRef(null); |
|
|
|
const { scrollYProgress } = useScroll({ container: ref }); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
const removeB = scrollYProgress.onChange((value) => { |
|
|
|
if (value > 0.5) |
|
|
|
{ |
|
|
|
document.querySelector('#img-one').classList.add('opacity-0'); |
|
|
|
document.querySelector('#img-one').classList.remove('opacity-1'); |
|
|
|
document.querySelector('#img-two').classList.remove('opacity-0'); |
|
|
|
document.querySelector('#img-two').classList.add('opacity-1'); |
|
|
|
} |
|
|
|
else{ |
|
|
|
document.querySelector('#img-one').classList.remove('opacity-0'); |
|
|
|
document.querySelector('#img-one').classList.add('opacity-1'); |
|
|
|
document.querySelector('#img-two').classList.add('opacity-0'); |
|
|
|
document.querySelector('#img-two').classList.remove('opacity-1'); |
|
|
|
} |
|
|
|
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'); |
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
// switch (value) { |
|
|
|
// case value > 0.2: |
|
|
|
// console.log(1); |
|
|
|
// //document.querySelectorAll('.image-switch'); |
|
|
|
// imageArray.forEach(el => el.classList.remove('active-image')); |
|
|
|
// imageArray[1].classList.add('active-image'); |
|
|
|
// break; |
|
|
|
// case value > 0.4: |
|
|
|
// console.log(2); |
|
|
|
// imageArray.forEach(el => el.classList.remove('active-image')); |
|
|
|
// imageArray[2].classList.add('active-image'); |
|
|
|
// break; |
|
|
|
// case value > 0.6: |
|
|
|
// imageArray.forEach(el => el.classList.remove('active-image')); |
|
|
|
// imageArray[3].classList.add('active-image'); |
|
|
|
// break; |
|
|
|
// case value > 0.8: |
|
|
|
// imageArray.forEach(el => el.classList.remove('active-image')); |
|
|
|
// imageArray[4].classList.add('active-image'); |
|
|
|
// break; |
|
|
|
// default: |
|
|
|
// imageArray.forEach(el => el.classList.remove('active-image')); |
|
|
|
// imageArray[0].classList.add('active-image'); |
|
|
|
// } |
|
|
|
|
|
|
|
return () => { |
|
|
|
|
|
|
|
removeB(); |
|
|
|
}; |
|
|
|
// if (value > 0.5) |
|
|
|
// { |
|
|
|
// document.querySelector('#img-one').classList.add('opacity-0'); |
|
|
|
// document.querySelector('#img-one').classList.remove('opacity-1'); |
|
|
|
// document.querySelector('#img-two').classList.remove('opacity-0'); |
|
|
|
// document.querySelector('#img-two').classList.add('opacity-1'); |
|
|
|
// } |
|
|
|
// else{ |
|
|
|
// document.querySelector('#img-one').classList.remove('opacity-0'); |
|
|
|
// document.querySelector('#img-one').classList.add('opacity-1'); |
|
|
|
// document.querySelector('#img-two').classList.add('opacity-0'); |
|
|
|
// document.querySelector('#img-two').classList.remove('opacity-1'); |
|
|
|
// } |
|
|
|
}); |
|
|
|
|
|
|
|
return () => { |
|
|
|
switchImage(); |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
return ( |
|
|
|
<div |
|
|
|
ref={ref} |
|
|
|
id="steps-container" |
|
|
|
className="steps-container flex flex-col items-center justify-start overflow-auto h-[75vh] pt-72p pl-3" |
|
|
|
> |
|
|
|
{/* Dynamic Image */} |
|
|
|
|
|
|
|
<img |
|
|
|
id="img-one" |
|
|
|
src={img} |
|
|
|
alt="Image not found" |
|
|
|
className="bg-fixed hidden sm:block absolute top-1/4 left-1/2 w-2/5 transition-all " |
|
|
|
/> |
|
|
|
<img |
|
|
|
id="img-two" |
|
|
|
src={img} |
|
|
|
alt="Image not found" |
|
|
|
className="bg-fixed hidden sm:block opacity-0 absolute top-1/4 left-1/2 w-2/5 transition-all rotate-180" |
|
|
|
/> |
|
|
|
|
|
|
|
<div className="local"> |
|
|
|
ref={ref} |
|
|
|
id="steps-container" |
|
|
|
className="steps-container no-scrollbar flex flex-col items-center justify-start overflow-auto h-[75vh] pt-72p pl-3" |
|
|
|
> |
|
|
|
{/* Dynamic Image */} |
|
|
|
{data.selection_process.steps.map((item, index) => ( |
|
|
|
<> |
|
|
|
{/* Section */} |
|
|
|
<div |
|
|
|
id={item.id} |
|
|
|
className="relative flex flex-col sm:flex-row items-start justify-center sm:gap-16 min-h-fit max-h[100vh] mb-28 md:mb-56" |
|
|
|
> |
|
|
|
{/* Line */} |
|
|
|
<hr className="bg-gray-400 w-full absolute -left-1/2 rotate-90" /> |
|
|
|
<img |
|
|
|
key={index} |
|
|
|
src={api_url + item.media.data.attributes.url} |
|
|
|
alt={item.media.data.attributes.alternativeText} |
|
|
|
className={ |
|
|
|
'image-switch bg-fixed hidden sm:block opacity-0 absolute top-1/4 left-1/2 w-2/5 transition-all' + |
|
|
|
(index == 0 ? ' active-image' : '') |
|
|
|
} |
|
|
|
/> |
|
|
|
))} |
|
|
|
|
|
|
|
{/* Dot */} |
|
|
|
<div className="z-10 p-[0.36rem] rounded-full bg-white border-solid border border-dg-primary-900 absolute -left-[0.63%] top-[1%]"></div> |
|
|
|
<div className="local"> |
|
|
|
{data.selection_process.steps.map((item, index) => ( |
|
|
|
<> |
|
|
|
{/* Section */} |
|
|
|
<div |
|
|
|
id={item.id} |
|
|
|
className="relative flex flex-col sm:flex-row items-start justify-center sm:gap-16 min-h-fit max-h[100vh] mb-28 md:mb-56" |
|
|
|
> |
|
|
|
{/* Line */} |
|
|
|
<hr className="bg-gray-400 w-full absolute -left-1/2 rotate-90" /> |
|
|
|
|
|
|
|
<div className="sm:w-1/2 ml-8"> |
|
|
|
<h3 className="h3-heading">{item.heading}</h3> |
|
|
|
<p className="text-sm text-dark-gray dark:text-white mt-4"> |
|
|
|
{item.paragraph} |
|
|
|
</p> |
|
|
|
{item.cto != null && ( |
|
|
|
<button className="btn-secondary mt-6 min-w-fit"> |
|
|
|
{item.cto} |
|
|
|
</button> |
|
|
|
)} |
|
|
|
{/* Dot */} |
|
|
|
<div className="z-10 p-[0.36rem] rounded-full bg-white border-solid border border-dg-primary-900 absolute -left-[0.63%] top-[1%]"></div> |
|
|
|
|
|
|
|
<div className="sm:w-1/2 ml-8"> |
|
|
|
<h3 className="h3-heading">{item.heading}</h3> |
|
|
|
<p className="text-sm text-dark-gray dark:text-white mt-4"> |
|
|
|
{item.paragraph} |
|
|
|
</p> |
|
|
|
{item.cto != null && ( |
|
|
|
<button className="btn-secondary mt-6 min-w-fit">{item.cto}</button> |
|
|
|
)} |
|
|
|
</div> |
|
|
|
<div className="w-1/2"></div> |
|
|
|
</div> |
|
|
|
<div className="w-1/2"></div> |
|
|
|
</div> |
|
|
|
</> |
|
|
|
))} |
|
|
|
</> |
|
|
|
))} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
} |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
export default HRProcess |
|
|
|
export default HRProcess; |