feat: make testimonials title configurable

This commit is contained in:
Oliver Davies 2023-10-16 10:25:28 +01:00
parent 95049a8711
commit 16d6c97821
3 changed files with 5 additions and 3 deletions

View file

@ -4,6 +4,7 @@ import _ from "lodash";
interface Props {
names: string[];
title?: string;
}
const defaultNames = [
@ -26,6 +27,7 @@ const defaultNames = [
'anonymous',
];
const { title } = Astro.props as Props;
const names = _(Astro.props.names || defaultNames);
const testimonials = await getCollection('testimonial', ({ id }) => names.includes(id));
@ -36,7 +38,7 @@ const sortedTestimonials = _(names)
---
{testimonials && (
<h2>What others have said</h2>
<h2>{title ?? 'What others have said'}</h2>
<div class="mt-6 space-y-14">
{_(sortedTestimonials).map(({ data: { image, name, tagline, text, url } }) => (