"use client"; import { useCallback, useEffect, useRef, useState } from "react"; import { IconArrowLeft, IconArrowRight, IconQuotes } from "@/app/constant"; const testimonialsData = [ { id: 1, quote: "Literally cannot imagine going without it. Thank you. We had some pretty crazy usage-based limitations for different features, as well as a free trial.", author: "DANIEL EDRISIAR", }, { id: 2, quote: "Amazing product. Amazing founders.", author: "NIZZY", }, { id: 3, quote: "Autumn is awesome. We've been happy customers since the very beginning - it was a no-brainer to be honest. The founders are in true founder mode.", author: "MAX PRILUTSKIY", }, { id: 4, quote: "What migrating to Autumn does (scroll!)", author: "Ben Y", }, { id: 5, quote: "Autumn fixed stripe. Trust me. Save you at least a week and potentially months of Stripe integration time. I wish we could have discovered Autumn earlier.", author: "Benny Kok", }, { id: 6, quote: "@autumnpricing is so good it ruined every other tool for me. nothing else even feels right anymore", author: "Can Vardar", }, ]; const Testimonials = () => { const scrollRef = useRef(null); const progressRef = useRef(null); const [canScrollLeft, setCanScrollLeft] = useState(false); const [canScrollRight, setCanScrollRight] = useState(true); // Only mount the hover-effect video on pointer:hover devices. Without this // every mobile visitor downloads one copy of the clip per testimonial (6× // the file) even though the hover effect they're gated on never triggers. const [isHoverDevice, setIsHoverDevice] = useState(false); useEffect(() => { setIsHoverDevice(window.matchMedia("(hover: hover)").matches); }, []); const handleScroll = useCallback(() => { if (scrollRef.current) { const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current; setCanScrollLeft(scrollLeft > 0); setCanScrollRight(scrollLeft + clientWidth < scrollWidth - 1); if (progressRef.current) { const maxScroll = scrollWidth - clientWidth; const progress = maxScroll > 0 ? (scrollLeft / maxScroll) * 100 : 0; progressRef.current.style.transform = `translateX(${progress}%)`; } } }, []); useEffect(() => { handleScroll(); window.addEventListener("resize", handleScroll); return () => window.removeEventListener("resize", handleScroll); }, [handleScroll]); const scrollByAmount = (amount: number) => { if (scrollRef.current) { scrollRef.current.scrollBy({ left: amount, behavior: "smooth" }); } }; return (

Built for teams
that move fast

{testimonialsData.map((testimonial) => (
{isHoverDevice && (
)}

{testimonial.quote}

{testimonial.author}
))}
); }; export default Testimonials;