feat(testimonials): allow for ordering by name
This commit is contained in:
parent
a6e691e442
commit
59b82c330f
|
@ -7,23 +7,29 @@ interface Props {
|
|||
}
|
||||
|
||||
const defaultNames = [
|
||||
'adam-cuddihy',
|
||||
'brian-hartwell',
|
||||
'anonymous',
|
||||
'huw-davies',
|
||||
'joe-howell',
|
||||
'michael-itkoff',
|
||||
'mick-felton',
|
||||
'duncan-davidson',
|
||||
'adam-cuddihy',
|
||||
'huw-davies',
|
||||
'scott-euser',
|
||||
'brian-hartwell',
|
||||
'alan-hatch',
|
||||
'holly-ross',
|
||||
'josh-mitchell',
|
||||
'brian-healy',
|
||||
'chris-jarvis',
|
||||
'daniel-easterbrook',
|
||||
'anonymous',
|
||||
];
|
||||
|
||||
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()
|
||||
const sortedTestimonials = _(names)
|
||||
.flatMap(name => testimonials.filter(testimonial => testimonial.id === name))
|
||||
.value();
|
||||
---
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ title: Book a 1-on-1 consulting call
|
|||
link: https://savvycal.com/opdavies/consulting-call
|
||||
price: £350
|
||||
testimonials:
|
||||
- michael-itkoff2
|
||||
- tom-evans
|
||||
- michael-itkoff2
|
||||
---
|
||||
|
||||
import Button from "~/components/Button.astro";
|
||||
|
|
|
@ -53,7 +53,7 @@ An upgrade roadmap is a personalised audit of your Drupal website and includes d
|
|||
|
||||
{/* Social proof */}
|
||||
|
||||
<Testimonials names={frontmatter.testimonials} />
|
||||
<Testimonials />
|
||||
|
||||
{/* Overcome objections */}
|
||||
|
||||
|
|
|
@ -5,27 +5,4 @@ title: Testimonials
|
|||
|
||||
import Testimonials from "~/components/Testimonials.astro";
|
||||
|
||||
<Testimonials names={[
|
||||
'adam-cuddihy',
|
||||
'alan-hatch',
|
||||
'anonymous',
|
||||
'brian-hartwell',
|
||||
'brian-healy',
|
||||
'chris-jarvis',
|
||||
'chris-knox',
|
||||
'daniel-easterbrook',
|
||||
'duncan-davidson',
|
||||
'holly-ross',
|
||||
'huw-davies',
|
||||
'james-chapman',
|
||||
'joe-howell',
|
||||
'jon-hallett',
|
||||
'josh-mitchell',
|
||||
'leonie-watson',
|
||||
'marlon-duncanson',
|
||||
'michael-itkoff',
|
||||
'mick-felton',
|
||||
'owen-phillips',
|
||||
'scott-euser',
|
||||
'tom-evans',
|
||||
]} />
|
||||
<Testimonials />
|
||||
|
|
Loading…
Reference in a new issue