Browse Source

Show recipe images in RecipeCard

Tatiana Inama 6 years atrás
parent
commit
c190cdd7d0
1 changed files with 2 additions and 1 deletions
  1. 2 1
      recipes/src/components/RecipeCard/index.tsx

+ 2 - 1
recipes/src/components/RecipeCard/index.tsx

@@ -8,6 +8,7 @@ import { List as Ingredients } from 'components/Ingredient';
 import moment from 'moment';
 
 import sample_img from "components/Card/sample.png";
+const API: string = process.env.REACT_APP_API || '';
 
 import './styles.scss';
 
@@ -24,7 +25,7 @@ function CBKRecipeCard(props: RecipeCardProps) {
   return (
     <Card outlined className='cbk-recipe-card'>
       <div className='cbk-recipe-card__primary'>
-        <CardMedia square imageUrl={sample_img} className='cbk-recipe-card__primary__image'/>
+        <CardMedia square imageUrl={recipe.image ? `${API}/${recipe.image}` : sample_img} className='cbk-recipe-card__primary__image'/>
         <div className='cbk-recipe-card__primary__title'>
           <h4>{recipe.name}</h4>
           <p>{recipe.summary}</p>