From: Jay Sitter Date: Tue, 27 Jun 2023 00:20:14 +0000 (-0400) Subject: fix: Move toggle button to its own function X-Git-Url: http://these/git/ui/assets/static/%7BcanonicalUrl%7D?a=commitdiff_plain;h=8b637a1773ca7df3e9445f3f151a07519f63a207;p=lemmy-ui.git fix: Move toggle button to its own function --- diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 2b761c5..9931219 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 ( <>