diff --git a/src/photo/PhotoLarge.tsx b/src/photo/PhotoLarge.tsx index d2357b35..59fc577a 100644 --- a/src/photo/PhotoLarge.tsx +++ b/src/photo/PhotoLarge.tsx @@ -115,6 +115,16 @@ export default function PhotoLarge({ prefetch={prefetch} />; + const matteContentWidthForAspectRatio = () => { + // Restrict width for landscape photos + // (portrait photos are always height restricted) + if (photo.aspectRatio > 3 / 2 + 0.1) { + return 'w-[90%]'; + } else if (photo.aspectRatio >= 1) { + return 'w-[80%]'; + } + }; + return (
= 1 - ? 'h-[80%]' - : 'h-[90%]', + arePhotosMatted && 'flex items-center justify-center', + // Always specify height to ensure fallback doesn't collapse + arePhotosMatted && 'h-[90%]', + arePhotosMatted && matteContentWidthForAspectRatio(), )}>