memorium/components/RecipeCard.tsx

30 lines
833 B
TypeScript
Raw Normal View History

2023-07-26 13:47:01 +02:00
import { Recipe } from "../lib/recipes.ts";
export function RecipeCard({ recipe }: { recipe: Recipe }) {
return (
<a
href={`/recipes/${recipe.id}`}
style={{
2023-07-26 15:48:03 +02:00
backgroundImage: `url(${
recipe?.meta?.image || "/api/recipes/images/placeholder.jpg"
}?width=200&height=200)`,
2023-07-26 13:47:01 +02:00
backgroundSize: "cover",
}}
2023-07-26 15:48:03 +02:00
class="bg-gray-900 text-white rounded-3xl shadow-md p-4 relative overflow-hidden
lg:w-56 lg:h-56
sm:w-40 sm:h-40
w-32 h-32"
2023-07-26 13:47:01 +02:00
>
2023-07-26 15:48:03 +02:00
<div class="h-full flex flex-col justify-between relative z-10">
<div>
{/* Recipe Card content */}
</div>
<div class="mt-2">
{recipe.name}
</div>
2023-07-26 13:47:01 +02:00
</div>
2023-07-26 15:48:03 +02:00
<div class="absolute inset-x-0 bottom-0 h-3/4 bg-gradient-to-t from-black to-transparent" />
2023-07-26 13:47:01 +02:00
</a>
);
}