From 077603b43e502026c01a94293588139bc7e8f074 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 25 Jun 2023 18:43:13 -0400 Subject: [PATCH] feat: Use plus/minus expand button in title for showing body/preview --- src/shared/components/post/post-listing.tsx | 53 ++++++++++----------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 86787cc..8815336 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -497,6 +497,25 @@ export class PostListing extends Component { /> ))} + + {/** + * If there is a URL, or if the post has a body and we were told not to + * show the body, show the MetadataCard/body toggle. + */} + {(post.url || (post.body && !this.props.showBody)) && ( + + )} + {post.removed && ( {I18NextService.i18n.t("removed")} @@ -634,27 +653,6 @@ export class PostListing extends Component { ); } - showPreviewButton() { - const post_view = this.postView; - const body = post_view.post.body; - - return ( - - ); - } - postActions() { // Possible enhancement: Priority+ pattern instead of just hard coding which get hidden behind the show more button. // Possible enhancement: Make each button a component. @@ -666,14 +664,7 @@ export class PostListing extends Component { {this.saveButton} {this.crossPostButton} - {/** - * If there is a URL, or if the post has a body and we were told not to - * show the body, show the MetadataCard/body toggle. - */} - {(post.url || (post.body && !this.props.showBody)) && - this.showPreviewButton()} - - {this.showBody && post_view.post.body && this.viewSourceButton} + {this.props.showBody && post_view.post.body && this.viewSourceButton}