import HoverServices from './shared/graphics/HoverServices'; import { useState, useEffect } from 'react'; import axios from 'axios'; import { motion } from 'framer-motion'; import Animation_Diligent from './../assets/animation_diligent.webm'; import './../styles/hexagon.css'; import Wrapper from '../layout/Wrapper'; const api_url = process.env.REACT_APP_API_URL; export default function ServicesHome() { const [hoverIndex, SetHoverIndex] = useState(0); const [change, SetChange] = useState(true); const [circle, SetCircle] = useState(0); const [triangle, SetTriangle] = useState(140); const [hex, SetHex] = useState(270); //const [angleTriangle, SetAngleTriangle] = useState(0); //const [angleHex, SetAngleHex] = useState(0); const [cntServicesHome, setCntServicesHome] = useState(''); const [isLoaded, setIsLoaded] = useState(''); const [text, setText] = useState( 'Expand your engineering team effectively with our staff augmentation service. Diligent helps to build dedicated teams tailored to the needs of your project to scale the capacity of your business.', ); const [ico, setIco] = useState( `${api_url}/uploads/Group_492_1_0ab4463650.png`, ); useEffect(() => { var vid = document.getElementById('sscreen'); vid.playbackRate = 2; }, []); useEffect(async () => { axios .get( `${api_url}/api/homepage?populate[0]=services&populate[1]=services.heading&populate[2]=services.serviceHome.icon`, ) .then(res => { setCntServicesHome(res.data.data.attributes); setIsLoaded(true); }) .catch(err => { console.log(err); setIsLoaded(false); }); if (hoverIndex > 0) { SetCircle(circle + 30); SetHex(hex + 30); SetTriangle(triangle + 30); } }, [hoverIndex]); // useEffect(() => { // if (change === true) { // const timer = setTimeout(() => SetChange(true), 1000); // return () => clearTimeout(timer); // } // }, [hoverIndex]); function handleHover(event) { if (change == true) { SetChange(false); SetHoverIndex(event.target.getAttribute('domIndex')); const timer = setTimeout(() => { SetChange(true); }, 100); return () => clearTimeout(timer); } } if (!isLoaded) { return (
); } return (
{/* Our Services Heading */}
{cntServicesHome.services.heading.subheading}

{cntServicesHome.services.heading.heading}

{/* Our Services Links */}
    {cntServicesHome.services.serviceHome.map((service, i) => (
  • { handleHover(e); setText(service.paragraph); setIco(api_url + service.icon.data.attributes.formats.thumbnail.url); }} > {i + 1 !== cntServicesHome.services.serviceHome.length && (
    )}
    {service.heading}
  • ))}
Service's Icon

{text}

); }