From 59b82c330f3ccd50257a8fea8df38eb76c726765 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 20 Sep 2023 13:00:00 +0100 Subject: [PATCH] feat(testimonials): allow for ordering by name --- src/components/Testimonials.astro | 20 +++++++++++++------- src/pages/call.mdx | 2 +- src/pages/drupal-upgrade.mdx | 2 +- src/pages/testimonials.mdx | 25 +------------------------ 4 files changed, 16 insertions(+), 33 deletions(-) diff --git a/src/components/Testimonials.astro b/src/components/Testimonials.astro index 3ebdba229..efe0da46b 100644 --- a/src/components/Testimonials.astro +++ b/src/components/Testimonials.astro @@ -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(); --- diff --git a/src/pages/call.mdx b/src/pages/call.mdx index fcf01947a..4c27f9a43 100644 --- a/src/pages/call.mdx +++ b/src/pages/call.mdx @@ -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"; diff --git a/src/pages/drupal-upgrade.mdx b/src/pages/drupal-upgrade.mdx index 4d75ef17d..96dfbdfff 100644 --- a/src/pages/drupal-upgrade.mdx +++ b/src/pages/drupal-upgrade.mdx @@ -53,7 +53,7 @@ An upgrade roadmap is a personalised audit of your Drupal website and includes d {/* Social proof */} - + {/* Overcome objections */} diff --git a/src/pages/testimonials.mdx b/src/pages/testimonials.mdx index 8e63062a8..fbdc7cdc3 100644 --- a/src/pages/testimonials.mdx +++ b/src/pages/testimonials.mdx @@ -5,27 +5,4 @@ title: Testimonials import Testimonials from "~/components/Testimonials.astro"; - +