43 lines
997 B
TypeScript
43 lines
997 B
TypeScript
import { Photo, altTextForPhoto } from '.';
|
|
import ImageTiny from '@/components/ImageTiny';
|
|
import Link from 'next/link';
|
|
import { clsx } from 'clsx/lite';
|
|
import { pathForPhoto } from '@/site/paths';
|
|
import { SHOULD_PREFETCH_ALL_LINKS } from '@/site/config';
|
|
|
|
export default function PhotoTiny({
|
|
photo,
|
|
tag,
|
|
selected,
|
|
className,
|
|
prefetch = SHOULD_PREFETCH_ALL_LINKS,
|
|
}: {
|
|
photo: Photo
|
|
tag?: string
|
|
selected?: boolean
|
|
className?: string
|
|
prefetch?: boolean
|
|
}) {
|
|
return (
|
|
<Link
|
|
href={pathForPhoto(photo, tag)}
|
|
className={clsx(
|
|
className,
|
|
'active:brightness-75',
|
|
selected && 'brightness-50',
|
|
'min-w-[50px]',
|
|
'rounded-[0.15rem] overflow-hidden',
|
|
'border border-gray-200 dark:border-gray-800',
|
|
)}
|
|
prefetch={prefetch}
|
|
>
|
|
<ImageTiny
|
|
src={photo.url}
|
|
aspectRatio={photo.aspectRatio}
|
|
blurData={photo.blurData}
|
|
alt={altTextForPhoto(photo)}
|
|
/>
|
|
</Link>
|
|
);
|
|
};
|