20 lines
500 B
TypeScript
20 lines
500 B
TypeScript
import { Card } from "@components/Card.tsx";
|
|
import { Recipe } from "@lib/resource/recipes.ts";
|
|
import { isLocalImage } from "@lib/string.ts";
|
|
|
|
export function RecipeCard({ recipe }: { recipe: Recipe }) {
|
|
const { meta: { image = "/placeholder.svg" } = {} } = recipe;
|
|
|
|
const imageUrl = isLocalImage(image)
|
|
? `/api/images?image=${image}&width=200&height=200`
|
|
: image;
|
|
|
|
return (
|
|
<Card
|
|
title={recipe.name}
|
|
image={imageUrl}
|
|
link={`/recipes/${recipe.id}`}
|
|
/>
|
|
);
|
|
}
|