1
0
Fork 0

Some formatting

This commit is contained in:
Amarpreet Minhas 2020-01-29 22:18:32 -05:00
parent 9c3037fb7e
commit 180a0a0cfb

View file

@ -7,52 +7,52 @@ import { Link } from 'react-router-dom';
class PostList extends React.Component {
componentDidMount() {
this.props.fetchPosts();
}
renderList() {
const {posts} = this.props
const postKeys = Object.keys(posts.entities)
return postKeys.map(id => {
const post = posts.entities[id]
return (
<div className="item" key={post.id}>
<div className="content">
<div className="description">
<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>
<h4>Posted {post.time_published}</h4>
<div className="markdown-body">
<ReactMarkdown source={post.content} />
</div>
</div>
</div>
</div>
);
}).reverse();
}
render () {
return (
<div>
<h1>Blog Posts</h1>
<div className="ui relaxed divided list">
{this.renderList()}
</div>
componentDidMount() {
this.props.fetchPosts();
}
renderList() {
const {posts} = this.props
const postKeys = Object.keys(posts.entities)
return postKeys.map(id => {
const post = posts.entities[id]
return (
<div className="item" key={post.id}>
<div className="content">
<div className="description">
<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>
<h4>Posted {post.time_published}</h4>
<div className="markdown-body">
<ReactMarkdown source={post.content} />
</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) => {
return {
posts: state.posts,
slug: state.slug
};
return {
posts: state.posts,
slug: state.slug
};
}
export default connect(
mapStateToProps,
{ fetchPosts }
mapStateToProps,
{ fetchPosts }
)(PostList);