Some formatting
This commit is contained in:
parent
9c3037fb7e
commit
180a0a0cfb
1 changed files with 41 additions and 41 deletions
|
@ -7,52 +7,52 @@ import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
|
||||||
class PostList extends React.Component {
|
class PostList extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.fetchPosts();
|
this.props.fetchPosts();
|
||||||
}
|
}
|
||||||
renderList() {
|
renderList() {
|
||||||
const {posts} = this.props
|
const {posts} = this.props
|
||||||
const postKeys = Object.keys(posts.entities)
|
const postKeys = Object.keys(posts.entities)
|
||||||
return postKeys.map(id => {
|
return postKeys.map(id => {
|
||||||
const post = posts.entities[id]
|
const post = posts.entities[id]
|
||||||
return (
|
return (
|
||||||
<div className="item" key={post.id}>
|
<div className="item" key={post.id}>
|
||||||
<div className="content">
|
<div className="content">
|
||||||
<div className="description">
|
<div className="description">
|
||||||
<h1><b><u><Link to={"/posts/" + post.slug}>{post.title}</Link></u></b></h1>
|
<h1><b><u><Link to={"/posts/" + post.slug}>{post.title}</Link></u></b></h1>
|
||||||
<h3><b>By <Link to={"/users/"+ post.author}>{post.author}</Link></b></h3>
|
<h3><b>By <Link to={"/users/"+ post.author}>{post.author}</Link></b></h3>
|
||||||
<h4>Posted {post.time_published}</h4>
|
<h4>Posted {post.time_published}</h4>
|
||||||
<div className="markdown-body">
|
<div className="markdown-body">
|
||||||
<ReactMarkdown source={post.content} />
|
<ReactMarkdown source={post.content} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}).reverse();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
render () {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<h1>Blog Posts</h1>
|
|
||||||
<div className="ui relaxed divided list">
|
|
||||||
{this.renderList()}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
</div>
|
||||||
}
|
</div>
|
||||||
|
);
|
||||||
|
}).reverse();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render () {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h1>Blog Posts</h1>
|
||||||
|
<div className="ui relaxed divided list">
|
||||||
|
{this.renderList()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
return {
|
return {
|
||||||
posts: state.posts,
|
posts: state.posts,
|
||||||
slug: state.slug
|
slug: state.slug
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
{ fetchPosts }
|
{ fetchPosts }
|
||||||
)(PostList);
|
)(PostList);
|
||||||
|
|
Reference in a new issue