import type { Photo } from '../photo'; import ImageCaption from '../image-response/components/ImageCaption'; import ImagePhotoGrid from '../image-response/components/ImagePhotoGrid'; import ImageContainer from '../image-response/components/ImageContainer'; import type { NextImageSize } from '@/platforms/next-image'; import { formatTag } from '@/tag'; import { generateRecipeLines, getRecipePropsFromPhotos } from '@/recipe'; import PhotoFilmIcon from '@/film/PhotoFilmIcon'; import { isStringFujifilmSimulationLabel, } from '@/platforms/fujifilm/simulation'; import IconRecipe from '@/components/icons/IconRecipe'; const MAX_RECIPE_LINES = 8; export default function RecipeImageResponse({ recipe, photos, width, height, fontFamily, smallText = true, }: { recipe: string, photos: Photo[] width: NextImageSize height: number fontFamily: string smallText?: boolean }) { const { data, film } = getRecipePropsFromPhotos(photos) ?? {}; let recipeLines = data && film ? generateRecipeLines({ data, film }, true) : []; if (recipeLines && recipeLines.length > MAX_RECIPE_LINES) { recipeLines = recipeLines.slice(0, MAX_RECIPE_LINES); recipeLines[MAX_RECIPE_LINES - 1] = '•••'; } return (
, title: formatTag(recipe).toLocaleUpperCase(), }}> {data &&
{recipeLines.map(text => (
{text} {isStringFujifilmSimulationLabel(text) && film &&
}
))}
} ); }