'use client'; import Image from 'next/image'; import React, { useState } from 'react'; import { RiTwitterXLine } from 'react-icons/ri'; type Mode = 'light' | 'dark'; interface Testimonial { image: string; name: string; username: string; text: string; social: string; } interface TestimonialProps { testimonials: Testimonial[]; mode?: Mode; } const UsernameTestimonial: React.FC = ({ testimonials, mode = 'light' }) => { const [showAll, setShowAll] = useState(false); const maxDisplayedTestimonials = 6; const handleLoadMore = () => { setShowAll(true); }; const openInNewTab = (url: string) => { const win = window.open(url, '_blank'); if (win) { win.focus(); } }; return (
Read what people are saying Dummy feedback from virtual customers
using our component library.
{testimonials.slice(0, showAll || testimonials.length <= maxDisplayedTestimonials ? testimonials.length : maxDisplayedTestimonials).map((testimonial, index) => (
profile
{testimonial.name} {testimonial.username}
{testimonial.text}
openInNewTab(testimonial.social || '')} className='absolute top-5 right-5 cursor-pointer'>
))}
{testimonials.length > maxDisplayedTestimonials && !showAll && (
)} {!showAll && (
)}
); }; export default UsernameTestimonial;