import { useNavigate } from "react-router-dom"; import { EngagementViewRecipe } from "../../services/EngagementService"; import { isApiError } from "../../types/api/error"; import type { Recipe } from "../../types/recipe"; import ServingSizeIconSmall from "../icons/ServingSizeIconSmall"; import StarIcon from "../icons/StarIcon"; import TimeIconSmall from "../icons/TimeIconSmall"; import RecipePlaceholder from "../../assets/images/recipe_placeholder.png"; interface RecipeSearchResultProps { recipe: Recipe; }; export default function RecipeSearchResult({ recipe }: RecipeSearchResultProps) { const navigate = useNavigate(); // HANDLERS const clickHandler = async () => { // Navigate first, so it feels faster await navigate(`/v2/web/recipe/${recipe.Id}`); const result = await EngagementViewRecipe(recipe.Id); if (isApiError(result)) { console.error(result.message); } } return (
{recipe.Tags.map(x => x.Name).join(", ")}
{recipe.Description}