diff --git a/components/Testimonial.js b/components/Testimonial.js index a4be27179549..52b48f2a2ecc 100644 --- a/components/Testimonial.js +++ b/components/Testimonial.js @@ -1,35 +1,80 @@ -import Paragraph from "./typography/Paragraph"; +import ArrowLeft from '../components/icons/ArrowLeft' +import ArrowRight from '../components/icons/ArrowRight' +import { useState, useEffect } from 'react'; +import testimonials from './TestimonialData'; + +const TestimonialCarousel = () => { + const [activeIndex, setActiveIndex] = useState(0); + const len = testimonials.length; + + const goToPrevious = () => { + setActiveIndex((prevIndex) => (prevIndex === 0 ? len - 1 : prevIndex - 1)); + }; + + const goToNext = () => { + setActiveIndex((prevIndex) => (prevIndex === len - 1 ? 0 : prevIndex + 1)); + }; + + const goToIndex = (index) => { + setActiveIndex(index); + }; + + useEffect(() => { + const interval = setInterval(goToNext, 10000); + return () => { + clearInterval(interval); + }; + }, [activeIndex]); -export default function Testimonial({ - className = '', - text, - authorName, - authorDescription, - authorAvatar, -}) { return ( -
-- --- {text} - -