From 4cf3b526a11efb6506889c4894375bcfcae76d3b Mon Sep 17 00:00:00 2001 From: Jake Runyan Date: Tue, 10 Feb 2026 09:40:25 -0800 Subject: [PATCH] Placeholder image when no image provided for the recipe --- components/RecipeCard.tsx | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/components/RecipeCard.tsx b/components/RecipeCard.tsx index 8a366de..e33d5ca 100644 --- a/components/RecipeCard.tsx +++ b/components/RecipeCard.tsx @@ -8,9 +8,9 @@ interface RecipeCardProps { export default function RecipeCard({ recipe }: RecipeCardProps) { // Convert relative path to public URL - const imageSrc = recipe.displayPhoto.startsWith('./') + const imageSrc = recipe.displayPhoto && recipe.displayPhoto.startsWith('./') ? `/recipes/${recipe.folderPath}/${recipe.displayPhoto.replace('./', '')}`.replace(/\\/g, '/') - : recipe.displayPhoto; + : recipe.displayPhoto || null; return (
- {`${recipe.title} + {imageSrc ? ( + {`${recipe.title} + ) : ( +
+ 🍽️ +
+ )}