-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathFoodBox.js
More file actions
26 lines (23 loc) · 865 Bytes
/
FoodBox.js
File metadata and controls
26 lines (23 loc) · 865 Bytes
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
import React from 'react';
import { Col, Card, Button } from 'antd';
export default function FoodBox(props) {
function handleDeleteClick() {
console.log('Handle delete click...');
props.deleteFood(props.food);
}
return (
<Col>
<Card
title={props.food.name}
style={{ width: 230, height: 300, margin: 10 }}
> <img src={props.food.image} height={60} alt={props.food.name} />
<p>Calories: {props.food.calories}</p>
<p>Servings: {props.food.servings}</p>
<p>
<b>Total Calories: {props.food.calories} * {props.food.servings}</b> kcal
</p>
<Button type="primary" onClick={handleDeleteClick}> Delete </Button>
</Card>
</Col>
)
}