fix(media): apply fill positioning classes to private image fallback

This commit is contained in:
2026-04-26 19:24:17 -04:00
parent c7ec34c560
commit 5ff1e0cd3c
@@ -26,12 +26,17 @@ export default function MediaImage({
const altText = alt ?? media.alt_text ?? media.original_name ?? '';
if (media.visibility !== 'public') {
// En mode `fill`, next/image se positionne en absolute pour remplir le
// parent relatif. On reproduit ce comportement avec `<img>` natif pour que
// les classes utilitaires (object-cover, object-contain) s'appliquent à
// l'image privée comme à la publique.
const fillClass = fill ? 'absolute inset-0 w-full h-full' : '';
// eslint-disable-next-line @next/next/no-img-element
return (
<img
src={url}
alt={altText}
className={className}
className={[fillClass, className].filter(Boolean).join(' ')}
loading={priority ? 'eager' : 'lazy'}
/>
);