Vercel/src/recipe/RecipeOGTile.tsx
Sam Becker e1af77d40c
OG image hovers (#268)
* Create og tooltip component

* Refactor og image handling

* Introduce category hover configuration

* Add og hovers to all categories

* Move category labels to client

* Disable og tooltips in headers

* Prevent og tooltips on accessory/loader hovers
2025-06-19 18:19:59 -05:00

49 lines
1.1 KiB
TypeScript

import { Photo, PhotoDateRange } from '@/photo';
import { pathForRecipe, pathForRecipeImage } from '@/app/paths';
import OGTile, { OGLoadingState } from '@/components/og/OGTile';
import { descriptionForRecipePhotos, titleForRecipe } from '.';
import { useAppText } from '@/i18n/state/client';
export default function RecipeOGTile({
recipe,
photos,
loadingState: loadingStateExternal,
riseOnHover,
onLoad,
onFail,
retryTime,
count,
dateRange,
}: {
recipe: string
photos: Photo[]
loadingState?: OGLoadingState
onLoad?: () => void
onFail?: () => void
riseOnHover?: boolean
retryTime?: number
count?: number
dateRange?: PhotoDateRange
}) {
const appText = useAppText();
return (
<OGTile {...{
title: titleForRecipe(recipe, photos, appText, count),
description: descriptionForRecipePhotos(
photos,
appText,
true,
count,
dateRange,
),
path: pathForRecipe(recipe),
pathImage: pathForRecipeImage(recipe),
loadingState: loadingStateExternal,
onLoad,
onFail,
riseOnHover,
retryTime,
}}/>
);
};