I have been looking for designs and I stumbled upon Material Design - Basil looking through the description I saw how Basil displays ingredients and was curious as to how that is done.
Link: https://material.io/design/material-studies/basil.html#components
it is the first item under the Components section.
I tried something like
const varRecipeIngredientBuilder
= jsnIngredients =>(
<div>
<ListItem>
<Grid item xs={1}>
<Checkbox/>
</Grid>
<Grid item xs={9}>
<h5>{jsnIngredients.name}{" . ".repeat(38 - jsnIngredients.name.length )}</h5>
</Grid>
<Grid item xs={1}>
<h5>{jsnIngredients.quantity}</h5>
</Grid>
<Grid item xs={1}>
{jsnIngredients.measurement}
</Grid>
</ListItem>
</div>
)
function RecipeIngredients ({json}){
return(
<List>
{json.map(varRecipeIngredientBuilder)}
</List>
)
};
export default RecipeIngredients;
I feel that I am close... but maybe that "38" should be something else.
right now some items in the list line up and some dont (even by using "."). the end slightly jagged in maybe 10% of the list and not as seamless as the example.
who knows, maybe the . is throwing me off and it isnt a text repeat.
Disclaimer: I have been using js/react for about 2 weeks now. I am a career data architect, so I understand design patterns... but it is still a new language to me. So to learn, I try and duplicate what i see.