Fix photo detail thumbnail count
This commit is contained in:
parent
fa998b6dc2
commit
1ef6e8a29a
@ -60,14 +60,19 @@ export default async function PhotoPage({
|
|||||||
|
|
||||||
if (!photo) { redirect(PATH_ROOT); }
|
if (!photo) { redirect(PATH_ROOT); }
|
||||||
|
|
||||||
const index = photos.findIndex(p => p.id === photoId);
|
const isPhotoFirst = photos.findIndex(p => p.id === photoId) === 0;
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
{children}
|
{children}
|
||||||
<PhotoDetailPage
|
<PhotoDetailPage
|
||||||
photo={photo}
|
photo={photo}
|
||||||
photos={photos}
|
photos={photos}
|
||||||
photosGrid={photos.slice(index === 0 ? 1 : 2)}
|
photosGrid={photos.slice(
|
||||||
|
isPhotoFirst ? 1 : 2,
|
||||||
|
isPhotoFirst
|
||||||
|
? GRID_THUMBNAILS_TO_SHOW_MAX + 1
|
||||||
|
: GRID_THUMBNAILS_TO_SHOW_MAX + 2,
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user