From 8b637a1773ca7df3e9445f3f151a07519f63a207 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Mon, 26 Jun 2023 20:20:14 -0400 Subject: [PATCH] fix: Move toggle button to its own function --- src/shared/components/post/post-listing.tsx | 34 ++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 2b761c56..9931219e 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -49,7 +49,7 @@ import { PurgeType, VoteContentType, } from "../../interfaces"; -import { mdNoImages, mdToHtml, mdToHtmlInline } from "../../markdown"; +import { mdToHtml, mdToHtmlInline } from "../../markdown"; import { I18NextService, UserService } from "../../services"; import { setupTippy } from "../../tippy"; import { Icon, PurgeWarning, Spinner } from "../common/icon"; @@ -489,19 +489,10 @@ export class PostListing extends Component { * If there is a URL, an embed title, and we were not told to show the * body by the parent component, show the MetadataCard/body toggle. */} - {!this.props.showBody && post.url && post.embed_title && ( - - )} + {!this.props.showBody && + post.url && + post.embed_title && + this.showPreviewButton()} {post.removed && ( @@ -1380,6 +1371,21 @@ export class PostListing extends Component { ); } + showPreviewButton() { + return ( + + ); + } + listing() { return ( <>