Sfoglia il codice sorgente

Add sample image when recipe has none

Tatiana Inama 6 anni fa
parent
commit
08adea7156

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

@@ -11,7 +11,7 @@ import '@material/react-card/dist/card.min.css';
 import '@material/react-button/dist/button.min.css';
 
 import './styles.scss';
-import sample_img from "./sample.png";
+import sample_img from "sample.png";
 const API: string = process.env.REACT_APP_IMG || '';
 
 type CBKCardProps = {

BIN
recipes/src/components/Card/sample.png


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

@@ -6,7 +6,7 @@ import { ScaleTool } from 'components/Ingredient/'
 import StrikeText from 'components/StrikeText';
 import moment from 'moment';
 
-import sample_img from "components/Card/sample.png";
+import sample_img from "sample.png";
 const API: string = process.env.REACT_APP_IMG || '';
 
 import './styles.scss';
@@ -22,7 +22,7 @@ const CBKRecipeCard: React.FunctionComponent<RecipeCardProps> = ({ recipe }) =>
   return (
     <div className="cbk-recipe-card">
       <div className="cbk-recipe-card__header">
-        <div className="cbk-recipe-card__header__media" style={recipe.image ? {backgroundImage: `url(${API}/${recipe.image})`} : undefined}></div>
+        <div className="cbk-recipe-card__header__media" style={{backgroundImage: `url(${recipe.image ? `${API}/${recipe.image}` : sample_img})`}}></div>
         <div className="cbk-recipe-card__header__name">
           <h4>
             { recipe.name }