From 85977430aa7da860d8e00094a33fa4381a6802b1 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Fri, 6 May 2022 18:46:49 -0500 Subject: [PATCH] Get poster video images from helper --- src/components/video/poster.astro | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/components/video/poster.astro b/src/components/video/poster.astro index 77d6539..4f55ab2 100644 --- a/src/components/video/poster.astro +++ b/src/components/video/poster.astro @@ -1,21 +1,14 @@ --- +import { getVideoImages } from '~/helpers/listing-page.js' const { video } = Astro.props -const webpSource = { - ...video.thumbnail, - srcset: video.thumbnail.srcset.replaceAll('ytimg.com/vi/', 'ytimg.com/vi_webp/').replace(/.png|.jpg|.jpeg/g, '.webp') -} - -const mergedSources = { - webp: webpSource, - jpeg: video.thumbnail -} +const images = getVideoImages( video ) --- - { Object.entries( mergedSources ).map( ([ key, source ]) => ( + { Object.entries( images.srcset ).map( ([ key, source ]) => (