Update Blog props

This commit is contained in:
LordMathis 2017-11-01 18:42:46 +01:00
parent bc01f94f6e
commit 4048fbbc66
2 changed files with 13 additions and 4 deletions

View File

@ -3,19 +3,27 @@ import React, {Component} from 'react';
export default class Blog extends Component {
render() {
if (this.props.data.isLoading) {
if (this.props.isLoading) {
return (
<h1>Loading</h1>
);
}
let posts = this.props.posts.map((post) => {
return (
<div>
<div>{post.published}</div>
<div>{post.filename}</div>
</div>
)
})
return (
<div>
<div className="content">
<h1>Blog</h1>
<div>{this.props.data.posts[0].published}</div>
<div>{this.props.data.posts[0].filename}</div>
{posts}
</div>
</div>

View File

@ -23,7 +23,8 @@ export default class BlogContainer extends Component {
render() {
return (
<Blog data={this.state}/>
<Blog isLoading={this.state.isLoading}
posts={this.state.posts}/>
)
}
}