-
Notifications
You must be signed in to change notification settings - Fork 0
/
Homepage.js
47 lines (46 loc) · 1.76 KB
/
Homepage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React, { Component } from 'react';
import AddRecipe from './AddRecipe';
import DisplayRecipe from './DisplayRecipe';
import Jumbotron from './Jumbotron';
import Search from './Search';
export default class Homepage extends Component {
constructor() {
super();
this.updateRecipe = this.updateRecipe.bind(this);
}
updateRecipe(data, id) {
this.props.updateRecipe(data, id)
}
render() {
const background = 'https://satinflame.com/img/stock/stock003.jpg';
return (
<div>
<Jumbotron handleAddClick={this.props.handleAddClick} background={background}/>
<Search
getRecipes={this.props.getRecipes} />
<main>
<div className='container'>
<div className="row">
<div className="card-columns">
{this.props.recipelist.map((item, index) => {
return <DisplayRecipe
getRecipes={this.props.getRecipes}
key={item._id}
id={item._id}
elementNo={index}
title={item.title}
picture={item.picture}
directions={item.directions}
ingredients={item.ingredients}
modalClass={this.modalClass}
updateRecipe={this.updateRecipe} />
})}
<AddRecipe message={this.props.message} handleCloseClick={this.props.handleCloseClick} saveRecipe={this.props.saveRecipe} modalClass={this.props.modalClass} recipelist={this.props.recipelist} getRecipes={this.props.getRecipes} />
</div>
</div>
</div>
</main>
</div>
);
}
}