From 16d6c978213cf73188a6f1d5426ec2ac48900297 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 16 Oct 2023 10:25:28 +0100 Subject: [PATCH] feat: make testimonials title configurable --- src/components/Testimonials.astro | 4 +++- src/pages/daily.mdx | 2 +- src/pages/testimonials.mdx | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/Testimonials.astro b/src/components/Testimonials.astro index d3a06c6b..9275b80b 100644 --- a/src/components/Testimonials.astro +++ b/src/components/Testimonials.astro @@ -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 && ( -

What others have said

+

{title ?? 'What others have said'}

{_(sortedTestimonials).map(({ data: { image, name, tagline, text, url } }) => ( diff --git a/src/pages/daily.mdx b/src/pages/daily.mdx index a3495625..a1ddcf76 100644 --- a/src/pages/daily.mdx +++ b/src/pages/daily.mdx @@ -25,7 +25,7 @@ import Testimonials from "~/components/Testimonials.astro";
- +
diff --git a/src/pages/testimonials.mdx b/src/pages/testimonials.mdx index fbdc7cdc..1e957c16 100644 --- a/src/pages/testimonials.mdx +++ b/src/pages/testimonials.mdx @@ -5,4 +5,4 @@ title: Testimonials import Testimonials from "~/components/Testimonials.astro"; - +