From 4a7a5b9c0947291119997f4ddea22bc4b98c43c0 Mon Sep 17 00:00:00 2001 From: donny Date: Thu, 28 May 2026 11:05:33 -0700 Subject: [PATCH] feat: add avatar to Testimonials component --- components/content/Testimonials.tsx | 38 ++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/components/content/Testimonials.tsx b/components/content/Testimonials.tsx index c261032..33eccc4 100644 --- a/components/content/Testimonials.tsx +++ b/components/content/Testimonials.tsx @@ -1,8 +1,17 @@ "use client"; import { useEffect, useState } from "react"; +import Image from "next/image"; import { IconPlayerPauseFilled, IconPlayerPlayFilled, IconPoint, IconPointFilled } from '@tabler/icons-react'; +function getInitials(name: string) { + return name + .split(/\s+/) + .map((part) => part[0]?.toUpperCase() ?? "") + .slice(0, 2) + .join(""); +} + type Testimonial = { name: string; title: string; @@ -31,18 +40,35 @@ export default function Testimonials({ items }: TestimonialsProps) { return () => clearInterval(id); }, [items.length, isPlaying]); + // TODO: fix bug - when clicking a pagination button, the auto-rotation timer doesn't reset, causing it to immediately rotate to the next testimonial after 5 seconds instead of 10 + return (
{/* header: avatar + name + title */} -
- {/* TODO: avatar */} +
+ {active.avatar ? ( + {active.name} + ) : ( +
+ {getInitials(active.name)} +
+ )}
-
{active.name}
-
{active.title}
+
{active.name}
+
{active.title}
-
{active.quote}
+
{active.quote}