diff --git a/src/components/HomeOne/HeroHomeOne.js b/src/components/HomeOne/HeroHomeOne.js index a582fb9..5c1bd79 100644 --- a/src/components/HomeOne/HeroHomeOne.js +++ b/src/components/HomeOne/HeroHomeOne.js @@ -5,6 +5,7 @@ import shapeTwo from '../../assets/images/shape/shape-2.png'; import shapeThree from '../../assets/images/shape/shape-3.png'; import shapeFour from '../../assets/images/shape/shape-4.png'; import getConfig from './../../Config/config' +import CustomSlider from '../customSlider/CustomSlider'; function HeroHomeOne() { @@ -44,7 +45,14 @@ function HeroHomeOne() { data-wow-duration="2000ms" data-wow-delay="200ms" > - WrenchBoard + {/* WrenchBoard */} +
+ +
{ +// imageElement.current.classList.add('sliding-images') +// setTimeout(()=>{ +// imageElement.current.classList.remove('sliding-images') +// }, 1000) +// if(count+1 && typeof(count) == 'number'){ +// return setSliderCount(count) +// } +// if(sliderCount >= images.length-1){ +// return setSliderCount(0) +// } +// setSliderCount(prev => prev + 1) +// } + +// useEffect(()=>{ +// const sliderInterval = setInterval(()=>{ +// sliderStart() +// }, speed*1000) +// return () => { +// clearInterval(sliderInterval) +// } +// },[sliderCount]) + +// return ( +//
+// image +//
+// {images.map((image, index)=>( +//
sliderStart(index)} +// className={`custom_indicator ${indicatorClass}`} +// style={{backgroundColor:`${sliderCount == index ? `${indicatorColor}` : ''}`, width:'15px', height: '15px', borderRadius: '999px', border: `1px solid ${indicatorColor}`, cursor:'pointer'}} +// >
+// ))} +//
+//
+// ) +// } + +// export default CustomSlider + +import React, { useEffect, useState } from 'react' + +function CustomSlider({images, speed, indicatorColor, indicatorClass}) { + let [sliderCount, setSliderCount] = useState(0) + + const sliderStart = (count) => { + if(count+1 && typeof(count) == 'number'){ + return setSliderCount(count) + } + if(sliderCount >= images.length-1){ + return setSliderCount(0) + } + setSliderCount(prev => prev + 1) + } + + useEffect(()=>{ + const sliderInterval = setInterval(()=>{ + sliderStart() + }, speed*1000) + return () => { + clearInterval(sliderInterval) + } + },[sliderCount]) + + return ( +
+
+ {images.map((image, index)=>( + image + ))} +
+
+ {images.map((image, index)=>( +
sliderStart(index)} + className={`custom_indicator ${indicatorClass}`} + style={{backgroundColor:`${sliderCount == index ? `${indicatorColor}` : ''}`, width:'15px', height: '15px', borderRadius: '999px', border: `1px solid ${indicatorColor}`, cursor:'pointer'}} + >
+ ))} +
+
+ ) +} + +export default CustomSlider \ No newline at end of file