-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
123 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { FaChevronLeft, FaChevronRight } from 'react-icons/fa'; | ||
import testimonials from './testimonials'; | ||
|
||
function Testimonials() { | ||
const [currentIndex, setCurrentIndex] = useState(0); | ||
const [isSmallScreen, setIsSmallScreen] = useState(false); | ||
const itemsPerPage = isSmallScreen ? 1 : 3; | ||
|
||
useEffect(() => { | ||
const checkScreenSize = () => { | ||
setIsSmallScreen(window.innerWidth < 768); | ||
}; | ||
|
||
checkScreenSize(); | ||
window.addEventListener('resize', checkScreenSize); | ||
|
||
return () => window.removeEventListener('resize', checkScreenSize); | ||
}, []); | ||
|
||
const handleNext = () => { | ||
setCurrentIndex((prevIndex) => (prevIndex + 1) % testimonials.length); | ||
}; | ||
|
||
const handlePrev = () => { | ||
setCurrentIndex((prevIndex) => (prevIndex - 1 + testimonials.length) % testimonials.length); | ||
}; | ||
|
||
const getVisibleTestimonials = () => { | ||
const end = currentIndex + itemsPerPage; | ||
if (end > testimonials.length) { | ||
return [...testimonials.slice(currentIndex), ...testimonials.slice(0, end - testimonials.length)]; | ||
} | ||
return testimonials.slice(currentIndex, end); | ||
}; | ||
|
||
return ( | ||
<div className='mb-9 flex flex-col gap-4 px-[2rem] md:px-[6.5rem]'> | ||
<div className='text-2xl font-bold text-black text-center'> | ||
What Our Users Say | ||
</div> | ||
<div className='relative w-full flex justify-center items-center'> | ||
<div className='absolute left-[-30px] top-1/2 transform -translate-y-1/2'> | ||
<button | ||
onClick={handlePrev} | ||
className='bg-transparent text-black p-2 rounded-full z-10 hover:bg-green-200 transition duration-300' | ||
> | ||
<FaChevronLeft size={35} /> | ||
</button> | ||
</div> | ||
<div className='w-full flex justify-center overflow-hidden'> | ||
<div className='flex transition-transform duration-500 ease-in-out gap-2'> | ||
{getVisibleTestimonials().map((testimonial, index) => ( | ||
<div key={index} className='flex-shrink-0 w-full md:w-1/3 p-2'> | ||
<div className='w-full p-4 bg-white border border-green-300 rounded-md shadow-md'> | ||
<div className='flex items-center gap-4 p-2'> | ||
<img src={testimonial.image} alt={testimonial.name} className='w-16 h-16 rounded-full' /> | ||
<div> | ||
<p className='text-lg font-semibold text-black'>{testimonial.name}</p> | ||
<p className='text-sm text-gray-600'>{testimonial.position}, {testimonial.company}</p> | ||
</div> | ||
</div> | ||
<p className='mt-4 text-gray-700'>{testimonial.text}</p> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
<div className='absolute right-[-35px] top-1/2 transform -translate-y-1/2'> | ||
<button | ||
onClick={handleNext} | ||
className='bg-transparent text-black p-2 rounded-full z-10 hover:bg-green-200 transition duration-300' | ||
> | ||
<FaChevronRight size={35} /> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Testimonials; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const testimonials = [ | ||
{ | ||
name: "John Doe", | ||
position: "Care Seeker", | ||
company: "Nacto Care", | ||
image: "https://dpemoji.com/wp-content/uploads/2023/01/Whatsapp-dp-for-boys-57.png", | ||
text: "Nacto Care has been a lifesaver for my family. The nurse we hired through their platform provided excellent care for my elderly parents. The entire process was smooth and professional." | ||
}, | ||
{ | ||
name: "Jane Smith", | ||
position: "Care Seeker", | ||
company: "Nacto Care", | ||
image: "https://t3.ftcdn.net/jpg/06/36/69/86/360_F_636698674_DroChEj5eWmZiaZOSDMnj8hcDqqw74Fp.jpg", | ||
text: "The personalized care plans and flexible scheduling options offered by Nacto Care made it easy for us to get the help we needed. The nurse was knowledgeable and compassionate." | ||
}, | ||
{ | ||
name: "Michael Johnson", | ||
position: "Customer", | ||
company: "Nacto Care", | ||
image: "https://dpemoji.com/wp-content/uploads/2023/01/Whatsapp-dp-for-boys-57.png", | ||
text: "I was impressed by the quality of service provided by Nacto Care. The platform is user-friendly, and the nurses are highly qualified. I would highly recommend them to anyone in need of home care services." | ||
}, | ||
{ | ||
name: "Emily Brown", | ||
position: "Care Seeker", | ||
company: "Nacto Care", | ||
image: "https://t3.ftcdn.net/jpg/06/36/69/86/360_F_636698674_DroChEj5eWmZiaZOSDMnj8hcDqqw74Fp.jpg", | ||
text: "Nacto Care connected us with a fantastic nurse who took great care of my grandfather. The support and attention to detail were outstanding. Thank you for making a difference in our lives." | ||
}, | ||
{ | ||
name: "Alex Williams", | ||
position: "Customer", | ||
company: "Nacto Care", | ||
image: "https://dpemoji.com/wp-content/uploads/2023/01/Whatsapp-dp-for-boys-57.png", | ||
text: "The life insurance scheme offered by Nacto Care gives us peace of mind knowing that our loved ones are protected. The nurse we hired was professional and dedicated to providing the best care possible." | ||
} | ||
]; | ||
|
||
export default testimonials; |