omakase/pages/recipe.jai

23 lines
593 B
Plaintext

get_recipe_page :: (req: Request) -> string {
id := table_find_pointer(*req.query, "id");
if !id then return "<h1>Error: invalid recipe id</h1>";
curRecipe : Recipe;
for state.recipes if it.id == id.* curRecipe = it;
if curRecipe.id == "" then return "<h1>Can't find recipe!</h1>";
builder : String_Builder;
add_navbar(*builder);
print_to_builder(*builder, recipeHero, curRecipe.image);
return builder_to_string(*builder);
}
recipeHero : string = #string DONE
<div class="recipe-hero">
<img id="parallax-img" src="%" alt="Steak">
</div>
DONE