Skip to content

Commit

Permalink
Nutrition prices and CRUD buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
bakaq committed Oct 5, 2024
1 parent 667c062 commit 2590476
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function ItemList() {
<div className="item-list">
<h2>Items</h2>
<button onClick={getItems}>Reload</button>
<button onClick={getItems}>Add (TODO)</button>
<ul className="item-list">{itemList}</ul>
</div>
);
Expand All @@ -59,17 +60,20 @@ function ItemCard({ itemData }) {
<li>Name: {itemData.name}</li>
<li>Price: R$ {itemData.price}</li>
<li>Weight: {itemData.weight}g</li>
<li>
Nutrition prices: <NutritionPrices nutritionPrices={itemData.nutrition_prices} />
</li>
<li>
Nutritional table: <NutritionalTable nutrition={itemData.nutrition} />
</li>
</ul>

<button>Edit (TODO)</button>
<button>Remove (TODO)</button>
</div>
);
}

function NutritionalTable({ nutrition }) {
console.log(nutrition);
return (
<div>
<ul>
Expand All @@ -81,4 +85,15 @@ function NutritionalTable({ nutrition }) {
)
}

function NutritionPrices({ nutritionPrices }) {
return (
<div>
<ul>
<li>Calories: {nutritionPrices.calories} g/R$</li>
<li>Protein: {nutritionPrices.protein} g/R$</li>
</ul>
</div>
)
}

export default App;

0 comments on commit 2590476

Please sign in to comment.