feat: make testimonials title configurable
This commit is contained in:
parent
95049a8711
commit
16d6c97821
|
@ -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 } }) => (
|
||||
|
|
|
@ -25,7 +25,7 @@ import Testimonials from "~/components/Testimonials.astro";
|
|||
</div>
|
||||
|
||||
<div>
|
||||
<Testimonials names={frontmatter.testimonials} />
|
||||
<Testimonials title={"What subscribers have said"} names={frontmatter.testimonials} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -5,4 +5,4 @@ title: Testimonials
|
|||
|
||||
import Testimonials from "~/components/Testimonials.astro";
|
||||
|
||||
<Testimonials />
|
||||
<Testimonials title={"What people have said"} />
|
||||
|
|
Loading…
Reference in a new issue