From f47dba0ae280deb29a73e8c6ffbaa1f1a7f287ea Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 15 Jul 2023 11:16:06 +0100 Subject: [PATCH] feat(testimonials): add default names --- src/components/Testimonials.astro | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/Testimonials.astro b/src/components/Testimonials.astro index 905f9e3b2..2856ef8a8 100644 --- a/src/components/Testimonials.astro +++ b/src/components/Testimonials.astro @@ -6,8 +6,19 @@ interface Props { names: string[]; } -const names = _(Astro.props.names); +const defaultNames = [ + 'adam-cuddihy', + 'anonymous', + 'huw-davies', + 'michael-itkoff', + 'mick-felton', + 'scott-euser', +]; + +const names = _(Astro.props.names || defaultNames); + const testimonials = await getCollection('testimonial', ({ id }) => names.includes(id)); + const sortedTestimonials = _(testimonials) .sort((a, b) => new Date(a.date) < new Date(b.date)) .reverse()