feat(testimonials): add default names

This commit is contained in:
Oliver Davies 2023-07-15 11:16:06 +01:00
parent 1db2dced3a
commit f47dba0ae2

View file

@ -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()