From 7649323a28ea08ee3a30b6b955094171b24e6333 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sun, 17 Sep 2023 20:43:50 -0500 Subject: [PATCH] Top align individual photos --- .../image-response/PhotoImageResponse.tsx | 12 +++------ .../components/ImagePhotoGrid.tsx | 27 ++++++++++++------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/photo/image-response/PhotoImageResponse.tsx b/src/photo/image-response/PhotoImageResponse.tsx index 23110080..ae5d54c0 100644 --- a/src/photo/image-response/PhotoImageResponse.tsx +++ b/src/photo/image-response/PhotoImageResponse.tsx @@ -4,6 +4,7 @@ import { formatModelShort } from '@/utility/exif'; import { AiFillApple } from 'react-icons/ai'; import ImageCaption from './components/ImageCaption'; import ImagePhotoGrid from './components/ImagePhotoGrid'; +import ImageContainer from './components/ImageContainer'; export default function PhotoImageResponse({ photo, @@ -19,18 +20,13 @@ export default function PhotoImageResponse({ fontFamily: string }) { return ( -
+ {photo.make === 'Apple' && @@ -50,6 +46,6 @@ export default function PhotoImageResponse({ {photo.isoFormatted}
- + ); }; diff --git a/src/photo/image-response/components/ImagePhotoGrid.tsx b/src/photo/image-response/components/ImagePhotoGrid.tsx index 91cc9a22..33009ff9 100644 --- a/src/photo/image-response/components/ImagePhotoGrid.tsx +++ b/src/photo/image-response/components/ImagePhotoGrid.tsx @@ -8,12 +8,14 @@ export default function ImagePhotoGrid({ request, width, height, + imagePosition = 'center', gap = 3, }: { photos: Photo[] request: Request width: number height: number + imagePosition?: 'center' | 'top' gap?: number }) { let count = 1; @@ -31,6 +33,11 @@ export default function ImagePhotoGrid({ const imagesPerRow = count / rows; + const cellWidth = width / imagesPerRow - + (imagesPerRow - 1) * gap / (imagesPerRow); + const cellHeight= height / rows - + (rows - 1) * gap / rows; + return (
- {photos.slice(0, count).map(photo => + {photos.slice(0, count).map(({ id, url }) =>
-
)} +
+ )} ); }