component: add price on top of BuildControls

master
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) => ( const buildControls = (props) => (
<div className={classes.BuildControls}> <div className={classes.BuildControls}>
<p>Current Price: <strong>{props.price.toFixed(2)}</strong></p>
{controls.map( ctrl => ( {controls.map( ctrl => (
<BuildControl <BuildControl
key={ctrl.name} key={ctrl.name}

View File

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