diff --git a/client/src/components/recipe/RecipeDetail.tsx b/client/src/components/recipe/RecipeDetail.tsx new file mode 100644 index 0000000..2ab59c5 --- /dev/null +++ b/client/src/components/recipe/RecipeDetail.tsx @@ -0,0 +1,55 @@ +import type { Recipe } from '../../types/recipe'; + +// Sier hva komponenten får inn. +type RecipeDetailProps = { + recipe: Recipe; +}; + +export function RecipeDetail({ recipe }: RecipeDetailProps) { + return ( +
+
+

{recipe.title}

+
+

{recipe.prepTime} minutter

+

{recipe.portions} porsjoner

+
+
+

{recipe.description}

+
+ +
+
+ {recipe.title}/ +
+
+

Ingredienser

+ +
+
+

Steg

+
    + {recipe.steps.map((step) => ( +
  1. + {step.instruction} +
  2. + ))} +
+
+
+ ); +} \ No newline at end of file diff --git a/client/src/routes/RecipeDetailPage.tsx b/client/src/routes/RecipeDetailPage.tsx index 1eacd42..1eeb6fb 100644 --- a/client/src/routes/RecipeDetailPage.tsx +++ b/client/src/routes/RecipeDetailPage.tsx @@ -1,8 +1,14 @@ import { useParams } from 'react-router'; +import { recipes } from '../mocks/recipes'; +import { RecipeDetail } from '../components/recipe/RecipeDetail'; // Placeholder for en oppskrift. Henter id fra URL-en. som /recipes/5 gir id = 5 export default function RecipeDetailPage() { const { id } = useParams(); + const recipe = recipes.find((r) => r.recipeId === id); + if (!recipe) { + return

Fant ikke oppskriften.

+ } - return

Oppskrift {id}

; + return ; }