diff options
author | Dessalines <happydooby@gmail.com> | 2019-04-04 19:08:21 -0700 |
---|---|---|
committer | Dessalines <happydooby@gmail.com> | 2019-04-04 19:08:21 -0700 |
commit | 4352b24734799d000612eaca1104ccecca7c757b (patch) | |
tree | 9b3eb4b66404431314c10a4cd4c82f0dbff34614 /ui/src/components/post-listing.tsx | |
parent | bf1ba48031198b535eeb21abcd01d6f2e8890f82 (diff) |
Adding some UI cancel buttons.
Diffstat (limited to 'ui/src/components/post-listing.tsx')
-rw-r--r-- | ui/src/components/post-listing.tsx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx index 348190fe..516baad3 100644 --- a/ui/src/components/post-listing.tsx +++ b/ui/src/components/post-listing.tsx @@ -34,6 +34,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> { this.handlePostLike = this.handlePostLike.bind(this); this.handlePostDisLike = this.handlePostDisLike.bind(this); this.handleEditPost = this.handleEditPost.bind(this); + this.handleEditCancel = this.handleEditCancel.bind(this); } render() { @@ -41,7 +42,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> { <div> {!this.state.showEdit ? this.listing() - : <PostForm post={this.props.post} onEdit={this.handleEditPost} /> + : <PostForm post={this.props.post} onEdit={this.handleEditPost} onCancel={this.handleEditCancel}/> } </div> ) @@ -144,6 +145,11 @@ export class PostListing extends Component<PostListingProps, PostListingState> { i.setState(i.state); } + handleEditCancel() { + this.state.showEdit = false; + this.setState(this.state); + } + // The actual editing is done in the recieve for post handleEditPost(post: Post) { this.state.showEdit = false; |