-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecipeList.js
41 lines (37 loc) · 1.26 KB
/
RecipeList.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from "react";
function RecipeList({recipes, deleteRecipe}) {
// TODO: Display the list of recipes using the structure of table that is provided.
// TODO: Create at least one additional component that is used by this component.
// TODO: Each recipe row must have a delete button - <button name="delete">Delete</button> - that deletes the post when clicked
return (
<div className="recipe-list">
<table>
<thead>
<tr>
<th>Name</th>
<th>Cuisine</th>
<th>Photo</th>
<th>Ingredients</th>
<th>Preparation</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{recipes.map((recipe, index) => (
<tr key={index}>
<td>{recipe.name}</td>
<td>{recipe.cuisine}</td>
<td><img className="photo" src={recipe.photo}/></td>
<td className="content_td"><p>{(recipe.ingredients)}</p></td>
<td className="content_td"><p>{(recipe.preparation)}</p></td>
<td>
<button name="delete" onClick={deleteRecipe}>Delete</button>
</td>
</tr>
))}
</tbody>
</table>
</div>
);
}
export default RecipeList;