Skip to content

Commit 3b50dea

Browse files
fix(layout): support dynamic testimonial avatar images on Careers page
1 parent e99e37f commit 3b50dea

1 file changed

Lines changed: 34 additions & 9 deletions

File tree

src/pages/careers/index.tsx

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,24 +172,47 @@ const testimonials = [
172172
role: "Senior Frontend Developer",
173173
content:
174174
"recode hive has given me the opportunity to work on cutting-edge projects while maintaining an amazing work-life balance. The team is incredibly supportive and collaborative.",
175-
avatar: "/img/testimonial-sarah.jpg",
175+
avatar: "/icons/vivien.png",
176176
},
177177
{
178178
name: "Marcus Johnson",
179179
role: "DevOps Engineer",
180180
content:
181181
"I love the remote-first culture here. The flexibility to work from anywhere has allowed me to travel while building my career. The learning opportunities are endless.",
182-
avatar: "/img/testimonial-marcus.jpg",
182+
avatar: "/icons/daniel.png",
183183
},
184184
{
185185
name: "Priya Patel",
186186
role: "Product Manager",
187187
content:
188188
"The growth mindset at recode hive is real. I've been able to take on new challenges and expand my skill set with full support from leadership.",
189-
avatar: "/img/testimonial-priya.jpg",
189+
avatar: "/icons/ethan.png",
190190
},
191191
];
192192

193+
function TestimonialAvatar({ avatar, name }: { avatar?: string; name: string }) {
194+
const [hasError, setHasError] = useState(false);
195+
196+
useEffect(() => {
197+
setHasError(false);
198+
}, [avatar]);
199+
200+
return (
201+
<div className="mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-gradient-to-br from-blue-400 to-purple-500 shadow-inner overflow-hidden relative">
202+
{avatar && !hasError ? (
203+
<img
204+
src={avatar}
205+
alt={name}
206+
className="h-full w-full object-cover rounded-full"
207+
onError={() => setHasError(true)}
208+
/>
209+
) : (
210+
<User className="h-10 w-10 text-white" />
211+
)}
212+
</div>
213+
);
214+
}
215+
193216
function CareersContent() {
194217
const { colorMode, isDark, mounted } = useSafeColorMode();
195218
const [activeTestimonial, setActiveTestimonial] = useState(0);
@@ -593,9 +616,10 @@ function CareersContent() {
593616
variants={fadeIn}
594617
>
595618
<div className="testimonial-content relative z-10 text-center">
596-
<div className="mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-gradient-to-br from-blue-400 to-purple-500 shadow-inner">
597-
<User className="h-10 w-10 text-white" />
598-
</div>
619+
<TestimonialAvatar
620+
avatar={testimonials[activeTestimonial].avatar}
621+
name={testimonials[activeTestimonial].name}
622+
/>
599623
<blockquote className="mb-6 text-lg italic md:text-xl">
600624
"{testimonials[activeTestimonial].content}"
601625
</blockquote>
@@ -639,9 +663,10 @@ function CareersContent() {
639663
) : (
640664
<div className="testimonial-carousel testimonial-carousel--light rounded-xl p-8 shadow-lg">
641665
<div className="testimonial-content relative z-10 text-center">
642-
<div className="mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-gradient-to-br from-blue-400 to-purple-500 shadow-inner">
643-
<User className="h-10 w-10 text-white" />
644-
</div>
666+
<TestimonialAvatar
667+
avatar={testimonials[activeTestimonial].avatar}
668+
name={testimonials[activeTestimonial].name}
669+
/>
645670
<blockquote className="mb-6 text-lg italic md:text-xl">
646671
"{testimonials[activeTestimonial].content}"
647672
</blockquote>

0 commit comments

Comments
 (0)