fix(post-detail): center carousel images of different sizes vertically

Regression from today's earlier "fill + object-contain" rework: fixing
that removed CarouselItem's flex items-center/justify-center, which is
what centered images in the carousel — because the shadcn Carousel
primitive's inner ref div (src/components/ui/carousel.tsx) never gets an
explicit height (its outer wrapper is hardcoded to just "overflow-hidden",
no className passthrough), the img's h-full never resolves to anything
definite there, so object-contain silently falls back to the image's
natural aspect-ratio sizing instead of fill+letterbox+center. Without
items-center, a shorter image among differently-sized carousel images
just sat flush at the top of the (taller, shared) row instead of centered.

The single-image path was unaffected — its container chain does resolve
to a definite height, so object-contain there works as intended.
This commit is contained in:
2026-08-14 20:18:47 +02:00
parent d2bfe53baa
commit aabb7d3074
+1 -1
View File
@@ -267,7 +267,7 @@ export function PostDetailDialog({ post, open, onClose, onDeleted }: PostDetailD
<Carousel setApi={setCarouselApi} className="h-full">
<CarouselContent className="h-full">
{images.map((img) => (
<CarouselItem key={img.id} className="basis-full h-full">
<CarouselItem key={img.id} className="basis-full h-full flex items-center justify-center">
<BlurImage
src={getMediaUrl(img.storageKey) ?? ""}
blurhash={img.blurhash}