Feat: images responsives vignettes Play + composant ResponsivePicture
- Config: presets thumbnail + thumbnail-webp (170/255/355/510/710w) - play.json.php: expose thumbnailSrcset + thumbnailWebp - Nouveau composant ResponsivePicture.svelte (src, srcset, webp, sizes, alt, cls) - Play.svelte: utilise ResponsivePicture dans le carousel sizes="clamp(170px, 18.41vw, 355px)" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
600ce937a3
commit
11a2c623cb
4 changed files with 57 additions and 3 deletions
28
src/components/ui/ResponsivePicture.svelte
Normal file
28
src/components/ui/ResponsivePicture.svelte
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<script>
|
||||
/**
|
||||
* Image responsive avec support WebP via <picture>.
|
||||
*
|
||||
* @prop {string} src — URL fallback (format original)
|
||||
* @prop {string} srcset — srcset format original (ex: "200w ..., 400w ...")
|
||||
* @prop {string} webp — srcset format WebP
|
||||
* @prop {string} sizes — valeur de l'attribut sizes
|
||||
* @prop {string} [alt] — texte alternatif
|
||||
* @prop {string} [cls] — classe CSS à appliquer sur <img>
|
||||
*/
|
||||
let { src, srcset, webp, sizes, alt = '', cls = '' } = $props()
|
||||
</script>
|
||||
|
||||
<picture>
|
||||
{#if webp}
|
||||
<source type="image/webp" srcset={webp} {sizes} />
|
||||
{/if}
|
||||
<img
|
||||
{src}
|
||||
{srcset}
|
||||
{sizes}
|
||||
{alt}
|
||||
class={cls}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
/>
|
||||
</picture>
|
||||
Loading…
Add table
Add a link
Reference in a new issue