From: Jay Sitter Date: Sun, 25 Jun 2023 22:43:13 +0000 (-0400) Subject: feat: Use plus/minus expand button in title for showing body/preview X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/save/static/README.ja.md?a=commitdiff_plain;h=077603b43e502026c01a94293588139bc7e8f074;p=lemmy-ui.git feat: Use plus/minus expand button in title for showing body/preview --- 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}