Forráskód Böngészése

Show images in Cards

Tatiana Inama 6 éve
szülő
commit
ba0149854b

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

@@ -12,6 +12,7 @@ import '@material/react-button/dist/button.min.css';
 
 import './styles.scss';
 import sample_img from "./sample.png";
+const API: string = process.env.REACT_APP_API || '';
 
 type CBKCardProps = {
   withImg?: boolean,
@@ -36,7 +37,7 @@ function CBKCard({onClick, img, title, summary, actions, icons, noMedia = false,
   return(
     <Card outlined className={`cbk-card ${className}`}>
       <CardPrimaryContent onClick={onClick}>
-        { noMedia ? null : <CardMedia square imageUrl={img || sample_img}></CardMedia>}
+        { noMedia ? null : <CardMedia square imageUrl={ img ? `${API}/${img}` : sample_img}></CardMedia>}
         <div className='cbk-card__main'>
           <h6 className='cbk-card__main__title'>{title}</h6>
           {

+ 1 - 0
recipes/src/containers/Recipes/List/index.tsx

@@ -156,6 +156,7 @@ class RecipeList extends Component<RecipeListProps, {phoneDisplay: boolean, sear
                       summary={recipe.summary}
                       actions={this.actions(recipe)}
                       icons={this.icons(recipe._id)}
+                      img={recipe.image}
                     />
                   )
                 })