Skip to content

Commit

Permalink
Add the quantity for each ingredient so the preview will display prop…
Browse files Browse the repository at this point in the history
…erly (#48)
  • Loading branch information
RyanNoelk authored May 27, 2020
1 parent 1bb88eb commit f4865f2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/recipe_form/components/IngredientBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,15 @@ class IngredientBox extends React.Component {
/>
<div className="recipe-details">
<div className="recipe-schema">
<IngredientGroups data={ this.state.data }/>
<IngredientGroups data={ [...this.state.data].map(x => {
// Add the quantity for each ingredient so the preview will display properly
const ings = [...x.ingredients].map(i => {return {
quantity: i.numerator ? formatQuantity(1, 1, i.numerator, i.denominator) + " " : '',
...i
}})

return { ...x, ingredients: ings }
})}/>
</div>
</div>
</TabbedView>
Expand Down

0 comments on commit f4865f2

Please sign in to comment.