-
- Home
+
+
Home
-
+
+
Mentor
-
- Blogs
+
+
Blogs
-
+
+
Community
-
- Career
+
+
Career
-
- Contact
+
+
Contact
{/* show profile card if user is logged in else show signin link */}
{isUserLoggedIn || isMentorLoggedIn ? (
@@ -203,6 +230,7 @@ function Header() {
href="/auth/login?entityType=user"
className="tw-text-xl tw-p-2 tw-font-inter tw-text-base-400 hover:tw-text-base-500 tw-font-medium"
>
+
Sign In
)}
diff --git a/components/mentorPage/components/Testimonials.js b/components/mentorPage/components/Testimonials.js
index 4e68ce7e..2e0229c5 100644
--- a/components/mentorPage/components/Testimonials.js
+++ b/components/mentorPage/components/Testimonials.js
@@ -9,85 +9,103 @@ import { RxDotFilled } from "react-icons/rx";
const Testimonials = ({ data }) => {
const [currentIndex, setCurrentIndex] = useState(0);
+ const [isAnimating, setIsAnimating] = useState(false);
const prevSlide = () => {
- if (currentIndex === 0) return setCurrentIndex(data.length - 1);
- setCurrentIndex((currentIndex - 1) % data.length);
+ if (isAnimating) return; // Prevent clicks during animation
+ setIsAnimating(true);
+ setTimeout(() => {
+ setCurrentIndex((prevIndex) =>
+ prevIndex === 0 ? data.length - 1 : prevIndex - 1
+ );
+ setIsAnimating(false);
+ }, 1000); // Match the duration of the CSS animation
};
const nextSlide = () => {
- setCurrentIndex((currentIndex + 1) % data.length);
+ if (isAnimating) return; // Prevent clicks during animation
+ setIsAnimating(true);
+ setTimeout(() => {
+ setCurrentIndex((prevIndex) => (prevIndex + 1) % data.length);
+ setIsAnimating(false);
+ }, 1000);
};
useEffect(() => {
const interval = setInterval(() => {
- setCurrentIndex((currentIndex + 1) % data.length);
- }, 5000);
+ nextSlide(); // Trigger the next slide automatically
+ }, 2000); // Slides every 5 seconds
+
return () => clearInterval(interval);
- }, [currentIndex]);
+ }, []);
return (
-
-
+
+
+ {data.map((testimonial, index) => (
+
+
+
+
+
+ {testimonial.testimonialUserName}
+
+
+ {testimonial.testimonialUserHeadline}
+
+
+ {[...Array(5)].map((star, i) => (
+
+ ))}
+
+
+ {testimonial.testimonialDescription}
+
+
+ ))}
+
- {/* left arraow */}
-
+
+ {/* Left arrow */}
+
- {/* right arrow */}
+ {/* Right arrow */}
-
-
-
- {data[currentIndex].testimonialUserName}
-
-
- {data[currentIndex].testimonialUserHeadline}
-
-
- {[...Array(5)].map((star, i) => {
- const ratingValue = i + 1;
- return (
-
- );
- })}
-
-
- {data[currentIndex].testimonialDescription}
-
-
-
+
+ {/* Dots */}
- {data.map((testimonial, index) => {
- return (
- setCurrentIndex(index)}
- />
- );
- })}
+ {data.map((testimonial, index) => (
+ setCurrentIndex(index)}
+ />
+ ))}
);
diff --git a/package.json b/package.json
index 072da7da..dddc15a5 100644
--- a/package.json
+++ b/package.json
@@ -40,7 +40,7 @@
"react-cookie": "^4.1.1",
"react-dom": "18.2.0",
"react-easy-crop": "^4.7.4",
- "react-icons": "^4.10.1",
+ "react-icons": "^4.12.0",
"react-owl-carousel": "^2.3.3",
"react-query": "^3.39.3",
"react-router-dom": "^6.14.1",