Vercel/src/photo/PhotoLightbox.tsx
Sam Becker 3b6001602a
Mobile Sidebar (#330)
* Show top entities on mobile

* Add config

* Localize 'more'/'less' text
2025-10-02 21:46:58 -05:00

58 lines
1.4 KiB
TypeScript

import { clsx } from 'clsx/lite';
import { Photo } from '.';
import { PhotoSetCategory } from '../category';
import PhotoGrid from './PhotoGrid';
import Link from 'next/link';
import { useAppText } from '@/i18n/state/client';
export default function PhotoLightbox({
count,
photos,
maxPhotosToShow = 6,
moreLink,
...categories
}: {
count: number
photos: Photo[]
maxPhotosToShow?: number
moreLink: string
} & PhotoSetCategory) {
const { utility } = useAppText();
const photoCountToShow = maxPhotosToShow < count
? maxPhotosToShow - 1
: maxPhotosToShow;
const countNotShown = count - photoCountToShow;
const showOverageTile = countNotShown > 0;
return (
<div className={clsx(
'border-main p-1.5 lg:p-2 rounded-md',
'bg-gray-50 dark:bg-gray-950',
)}>
<PhotoGrid
{...categories}
photos={photos.slice(0, photoCountToShow)}
animate={false}
additionalTile={showOverageTile
? <Link
href={moreLink}
className={clsx(
'flex flex-col items-center justify-center',
'gap-0.5 lg:gap-1',
)}
>
<div className="text-[1.1rem] lg:text-[1.5rem]">
+{countNotShown}
</div>
<div className="text-dim">{utility.more}</div>
</Link>
: undefined}
small
/>
</div>
);
}