Vercel/src/photo/PhotoOGTile.tsx
2025-03-18 09:26:56 -05:00

45 lines
1.0 KiB
TypeScript

import {
Photo,
descriptionForPhoto,
titleForPhoto,
} from '@/photo';
import { PhotoSetCategory } from '../category/set';
import { absolutePathForPhotoImage, pathForPhoto } from '@/app/paths';
import OGTile from '@/components/OGTile';
export type OGLoadingState = 'unloaded' | 'loading' | 'loaded' | 'failed';
export default function PhotoOGTile({
photo,
loadingState: loadingStateExternal,
riseOnHover,
onLoad,
onFail,
retryTime,
onVisible,
...categories
}: {
photo: Photo
loadingState?: OGLoadingState
onLoad?: () => void
onFail?: () => void
riseOnHover?: boolean
retryTime?: number
onVisible?: () => void
} & PhotoSetCategory) {
return (
<OGTile {...{
title: titleForPhoto(photo),
description: descriptionForPhoto(photo),
path: pathForPhoto({ photo, ...categories }),
pathImageAbsolute: absolutePathForPhotoImage(photo),
loadingState: loadingStateExternal,
onLoad,
onFail,
riseOnHover,
retryTime,
onVisible,
}} />
);
};