@@ -45,7 +45,7 @@ export function Testimonials() {
4545
4646 const [ api , setApi ] = useState < CarouselApi > ( )
4747 const [ current , setCurrent ] = useState ( 0 )
48- // const [count, setCount ] = useState(0 )
48+ const [ isInteracting , setIsInteracting ] = useState ( false )
4949
5050 useEffect ( ( ) => {
5151 if ( ! api ) {
@@ -65,17 +65,18 @@ export function Testimonials() {
6565 < div className = '' >
6666 DurianPy Ratings
6767 </ div >
68- < div className = 'relative' >
68+
69+ { /* Carousel */ }
70+ < div className = 'relative' onClick = { ( ) => setIsInteracting ( true ) } onMouseLeave = { ( ) => setIsInteracting ( false ) } >
6971 < button className = 'z-20 absolute left-0 md:left-8 bottom-1/2 bg-opacity-0' onClick = { ( ) => api ?. scrollTo ( current - 1 ) } >
7072 < Image src = { prevArrowIcon } alt = 'Prev' className = 'w-2/3' />
7173 </ button >
7274 < CarouselContainer setApi = { setApi }
7375 opts = { { loop : true } }
74- autoplay = { false }
75- autoplayInterval = { 3000 }
76+ autoplay = { ! isInteracting }
77+ autoplayInterval = { 5000 }
7678 className = "mx-auto px-[10%]"
7779 >
78- { /* mx-auto max-w-[1280px] */ }
7980 < CarouselContent className = 'mx-auto py-20' >
8081 { dummyData . map ( ( data , index ) => (
8182 < CarouselItem className = "relative px-[3%] flex justify-center lg:basis-1/3" key = { index } >
@@ -94,7 +95,7 @@ export function Testimonials() {
9495}
9596
9697// Number of Stars depending on rating.
97- const Ratings = ( { rate, className } : { rate : number , className : string } ) => {
98+ const Ratings = ( { rate } : { rate : number } ) => {
9899 const starRate = [ ]
99100
100101 // Append stars
@@ -108,7 +109,7 @@ const Ratings = ({ rate, className }: { rate: number, className: string }) => {
108109 }
109110
110111 return (
111- < div className = { cn ( 'flex justify-center' , className ) } > { starRate } </ div >
112+ < div className = 'flex justify-center absolute top-[5%] left-1/2 -translate-x-1/2' > { starRate } </ div >
112113 )
113114}
114115
@@ -118,11 +119,11 @@ const TestimonialCard = ({ name, date, comment, rate, profilePic, className }: t
118119 { /* SPEECH BUBBLE */ }
119120 < div className = 'relative' >
120121 < Image src = { testimonialCard } alt = 'testimonial card' priority = { true } />
121- < Ratings rate = { rate } className = 'absolute top-[5%] left-1/2 -translate-x-1/2' />
122+ < Ratings rate = { rate } />
122123 < div className = 'absolute h-1/2 inset-y-1/4 px-[5%] text-white text-xs sm:text-base lg:text-base xl:text-lg overflow-hidden text-ellipsis xl:leading-6' >
123124 { comment }
124125 </ div >
125- < a className = "absolute h-fit pt-[15%] px-[4%] inset-x-1 bottom-1/4 text-[#B3B3B3] underline underline-offset-2 decoration-1 text-xs sm:text-base bg-gradient-to-t from-medium-dark-green from-50%" > Read More</ a >
126+ < a href = '/404' target = '_blank' className = "absolute h-fit pt-[15%] px-[4%] inset-x-1 bottom-[24%] text-[#B3B3B3] underline underline-offset-2 decoration-1 text-xs sm:text-base bg-gradient-to-t from-medium-dark-green from-50% -mt-3 " > Read More</ a >
126127 </ div >
127128
128129 { /* USER AVATAR & NAME */ }
0 commit comments