mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Use poster component for cards
This commit is contained in:
parent
7b004ea590
commit
f7d7c7266f
3 changed files with 37 additions and 42 deletions
|
|
@ -1,33 +1,4 @@
|
|||
function renderPoster ( video ) {
|
||||
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
|
||||
}
|
||||
|
||||
return /* html */`
|
||||
<picture>
|
||||
|
||||
${ Object.entries( mergedSources ).map( ([ key, source ]) => (/* html */`
|
||||
<source
|
||||
sizes="${ source.sizes }"
|
||||
data-srcset="${ source.srcset }"
|
||||
type="image/${ key }"
|
||||
>
|
||||
`) ).join('') }
|
||||
|
||||
<img
|
||||
:data-src="${ video.thumbnail.src }"
|
||||
alt="${ video.name }"
|
||||
class="absolute inset-0 h-full w-full object-cover lazyload"
|
||||
>
|
||||
</picture>
|
||||
`
|
||||
}
|
||||
import renderPoster from './poster.js'
|
||||
|
||||
function renderTimestamps ( video ) {
|
||||
const timestampsForRender = video.timestamps.map( timestamp => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue