memorium/components/RecipeCard.tsx

19 lines
460 B
TypeScript
Raw Normal View History

import { Card } from "@components/Card.tsx";
import { Recipe } from "@lib/recipes.ts";
2023-07-26 13:47:01 +02:00
export function RecipeCard({ recipe }: { recipe: Recipe }) {
2023-07-30 21:43:09 +02:00
const { meta: { image = "/placeholder.svg" } = {} } = recipe;
const imageUrl = image.startsWith("Recipes/images/")
? `/api/images?image=${image}&width=200&height=200`
: image;
2023-07-26 13:47:01 +02:00
return (
<Card
title={recipe.name}
image={imageUrl}
link={`/recipes/${recipe.id}`}
/>
2023-07-26 13:47:01 +02:00
);
}