component: add price on top of BuildControls

This commit is contained in:
oscarzhou 2020-12-10 21:04:39 +13:00
parent 9a9f85110c
commit 54d018b854
2 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,7 @@ const controls = [
const buildControls = (props) => (
<div className={classes.BuildControls}>
<p>Current Price: <strong>{props.price.toFixed(2)}</strong></p>
{controls.map( ctrl => (
<BuildControl
key={ctrl.name}

View File

@ -75,7 +75,8 @@ class BurgerBuilder extends Component {
<BuildControls
ingredientAdded={this.addIngredientHandler}
ingredientRemoved={this.removeIngredientHandler}
disabled={disabledInfo} />
disabled={disabledInfo}
price={this.state.totalPrice} />
</Aux>
);
};