Repository
https://github.com/knacksteem/knacksteem.org
Pull Request
https://github.com/knacksteem/knacksteem.org/pull/65
About knacksteem.org
"Do you have any talent? If yes! then KnackSteem is for you."
"Rewards people with talents, it can be any talent, anything you know how to do best is highly welcome on the platform."
Changes / New Features
- Implement edit function for articles and comments.
- Implement reply to articles/comments.
Details
In the articleDetail component, which shows a particular post, When the buttons edit and reply are clicked, the state in the article is changed and set to isReply true and if it is a comment, the state property isComment would be set to true and the editor is showed . Next we check if the editor is receiving props in the componentWillReceieveProps life cycle event and set the value of the articleData being passed to the editor component as the next props. In the componentDidMount we set the value of the editor to the new prop passed in then we can edit the value in the onChange Event.
componentDidMount() {
..........................
const {articleData, isEdit, isComment} = this.props;
if(isEdit){
this.setValues(articleData);
}
if (isComment && isEdit)
{
this.setValues(articleData)
}
}
What's next?
Adding a app side bar for mobile mode.
commits
https://github.com/knacksteem/knacksteem.org/pull/65/commits/4658b085096fd20994ea80df6bca75121d588dd9
https://github.com/knacksteem/knacksteem.org/pull/65/commits/daae02d695134c5aa40a334eaf754e582f47e536
https://github.com/knacksteem/knacksteem.org/pull/65/commits/e81ffddda3838e7e51274942d647aed90ebae34a
Repo
https://github.com/ogbiyoyosky
Same thing happens in the editing of comment, we just need to know if comment is the props passed in. We can dispatch actions for either posting or editing.