diff --git a/src/components/Blog.js b/src/components/Blog.js index 03a5c9f..f9e4b66 100644 --- a/src/components/Blog.js +++ b/src/components/Blog.js @@ -21,44 +21,33 @@ export default class Blog extends Component { render () { const md = MarkdownIt() + let postsHTML if (this.props.isLoading) { - return ( -
-
-
- + postsHTML = + } else { + const posts = this.props.posts.sort((a, b) => { + return new Date(b.published) - new Date(a.published) + }) + + if (posts.length < 1) { + postsHTML = ( +
+ No posts found
- -
- ) - } - - const posts = this.props.posts.sort((a, b) => { - return new Date(b.published) - new Date(a.published) - }) - let postsHTML = posts.map((post) => -
-
- {post.title} - {post.published} -
-
-
-
- ) - - if (postsHTML.length < 1) { - postsHTML = ( -
- No posts found -
- ) + ) + } else { + postsHTML = posts.map((post) => +
+
+ {post.title} + {post.published} +
+
+
+
+ ) + } } return (