diff --git a/site/config/config.php b/site/config/config.php index cbb056b..6939e9e 100644 --- a/site/config/config.php +++ b/site/config/config.php @@ -108,6 +108,21 @@ return [ '600w' => ['width' => 600, 'format' => 'webp'], '800w' => ['width' => 800, 'format' => 'webp'], ], + // Vignettes jeux — active: clamp(170px, 18.41vw, 355px), retina 2x → 710px + 'thumbnail' => [ + '170w' => ['width' => 170], + '255w' => ['width' => 255], + '355w' => ['width' => 355], + '510w' => ['width' => 510], + '710w' => ['width' => 710], + ], + 'thumbnail-webp' => [ + '170w' => ['width' => 170, 'format' => 'webp'], + '255w' => ['width' => 255, 'format' => 'webp'], + '355w' => ['width' => 355, 'format' => 'webp'], + '510w' => ['width' => 510, 'format' => 'webp'], + '710w' => ['width' => 710, 'format' => 'webp'], + ], ], ], ]; \ No newline at end of file diff --git a/site/templates/play.json.php b/site/templates/play.json.php index feeb766..3cf86ec 100644 --- a/site/templates/play.json.php +++ b/site/templates/play.json.php @@ -8,6 +8,8 @@ $specificData = [ 'lettering' => $game->lettering()->toFile()?->url(), 'description' => $game->description()->value(), 'thumbnail' => $game->thumbnail()->toFile()?->url(), + 'thumbnailSrcset' => $game->thumbnail()->toFile()?->srcset('thumbnail'), + 'thumbnailWebp' => $game->thumbnail()->toFile()?->srcset('thumbnail-webp'), 'backgroundColor' => $game->backgroundColor()->value() ?: null, 'preview' => $game->preview()->toFile()?->url(), 'playLink' => $game->playLink()->value() ?: null, diff --git a/src/components/ui/ResponsivePicture.svelte b/src/components/ui/ResponsivePicture.svelte new file mode 100644 index 0000000..74f6b04 --- /dev/null +++ b/src/components/ui/ResponsivePicture.svelte @@ -0,0 +1,28 @@ + + + + {#if webp} + + {/if} + + diff --git a/src/views/Play.svelte b/src/views/Play.svelte index 3700179..8c25c97 100644 --- a/src/views/Play.svelte +++ b/src/views/Play.svelte @@ -1,6 +1,7 @@