|
@@ -1,5 +1,5 @@
|
|
|
import React, { Component } from 'react';
|
|
import React, { Component } from 'react';
|
|
|
-import IRecipe from '../../types/recipes';
|
|
|
|
|
|
|
+import IRecipe, { IIngComponent, IIngredient } from '../../types/recipes';
|
|
|
import Card, {
|
|
import Card, {
|
|
|
CardActions,
|
|
CardActions,
|
|
|
CardActionButtons,
|
|
CardActionButtons,
|
|
@@ -16,6 +16,41 @@ import { ReactComponent as Servings } from 'svgs/servings.svg';
|
|
|
|
|
|
|
|
import './styles.scss';
|
|
import './styles.scss';
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+type ShowIngredientsProps = {
|
|
|
|
|
+ ingredients: IIngComponent[]
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+function ShowIngredients(props: ShowIngredientsProps) {
|
|
|
|
|
+ const { ingredients } = props;
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className="cbk-ingredient-list">
|
|
|
|
|
+ {
|
|
|
|
|
+ ingredients.map((item, i) => (
|
|
|
|
|
+ <ul key={i}>
|
|
|
|
|
+ {
|
|
|
|
|
+ item.name ?
|
|
|
|
|
+ <li className="section-name">
|
|
|
|
|
+ {item.name}
|
|
|
|
|
+ </li>
|
|
|
|
|
+ : null
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ item.ingredients.map((ing, j) => (
|
|
|
|
|
+ <li className='ingredient' key={j}>
|
|
|
|
|
+ <span>{ing.name}</span>
|
|
|
|
|
+ <span>{ing.quantity + ing.unit}</span>
|
|
|
|
|
+ </li>
|
|
|
|
|
+ ))
|
|
|
|
|
+ }
|
|
|
|
|
+ </ul>
|
|
|
|
|
+ ))
|
|
|
|
|
+ }
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
type RecipeCardProps = {
|
|
type RecipeCardProps = {
|
|
|
recipe: IRecipe,
|
|
recipe: IRecipe,
|
|
|
}
|
|
}
|
|
@@ -51,6 +86,7 @@ function CBKRecipeCard(props: RecipeCardProps) {
|
|
|
</div>
|
|
</div>
|
|
|
<div className='cbk-recipe-card__content'>
|
|
<div className='cbk-recipe-card__content'>
|
|
|
<div className='cbk-recipe-card__content__ingredients'>
|
|
<div className='cbk-recipe-card__content__ingredients'>
|
|
|
|
|
+ <ShowIngredients ingredients={recipe.ingredients} />
|
|
|
</div>
|
|
</div>
|
|
|
<div className='cbk-recipe-card__content__instructions'>
|
|
<div className='cbk-recipe-card__content__instructions'>
|
|
|
<ol>
|
|
<ol>
|