// components import Spring from '@components/Spring'; import Testimonial from '@components/Testimonial'; import ScrollContainer from '@components/ScrollContainer'; import AddFormContainer from '@components/AddFormContainer'; import CustomRating from '@ui/CustomRating'; // hooks import useMeasure from 'react-use-measure'; import {useForm, Controller} from 'react-hook-form'; import {useState, useEffect, useRef} from 'react'; // utils import classNames from 'classnames'; const data = [ { text: 'Wore these with my training tee and pods to a graduation bbq. Love the look and feel.', author: 'Jacob Sullivan', rating: 4.5, }, { text: 'I\'m enjoying playing football!', author: 'Max Power', rating: 5, }, { text: 'I\'m enjoying playing football!', author: 'Sunny Drew', rating: 5, } ] const Testimonials = () => { const {register, handleSubmit, formState: {errors}, reset, control} = useForm({ defaultValues: { text: '', author: '', rating: 5, } }); const [isFormOpen, setIsFormOpen] = useState(false); const [ref, {height}] = useMeasure(); const trackRef = useRef(null); const onReset = () => { reset(); setIsFormOpen(false); } const onSubmit = (data) => { // do something with data onReset(); } useEffect(() => { trackRef.current && trackRef.current.scrollTo(0, 0); }, [isFormOpen]); return (