feat(testimonials): add default names
This commit is contained in:
parent
1db2dced3a
commit
f47dba0ae2
|
@ -6,8 +6,19 @@ interface Props {
|
||||||
names: string[];
|
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 testimonials = await getCollection('testimonial', ({ id }) => names.includes(id));
|
||||||
|
|
||||||
const sortedTestimonials = _(testimonials)
|
const sortedTestimonials = _(testimonials)
|
||||||
.sort((a, b) => new Date(a.date) < new Date(b.date))
|
.sort((a, b) => new Date(a.date) < new Date(b.date))
|
||||||
.reverse()
|
.reverse()
|
||||||
|
|
Loading…
Reference in a new issue