summaryrefslogtreecommitdiffstats
path: root/ui/src/components/post-listing.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-04-03 13:46:25 -0400
committerDessalines <tyhou13@gmx.com>2020-04-03 13:46:25 -0400
commit0ca385deaf00d905081c66d0e0164558531e0e70 (patch)
tree8521f8f9a571fa644bc940abaa84a61faf539aa8 /ui/src/components/post-listing.tsx
parenta497a568db6349b25f7b662079141f8a3ddfb6cd (diff)
Adding a text body preview and icon for posts with a body. Fixes #617
Diffstat (limited to 'ui/src/components/post-listing.tsx')
-rw-r--r--ui/src/components/post-listing.tsx20
1 files changed, 20 insertions, 0 deletions
diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx
index ff863dcb..101d1807 100644
--- a/ui/src/components/post-listing.tsx
+++ b/ui/src/components/post-listing.tsx
@@ -20,6 +20,7 @@ import { MomentTime } from './moment-time';
import { PostForm } from './post-form';
import { IFramelyCard } from './iframely-card';
import {
+ md,
mdToHtml,
canMod,
isMod,
@@ -30,6 +31,7 @@ import {
showAvatars,
pictshareImage,
setupTippy,
+ previewLines,
} from '../utils';
import { i18n } from '../i18next';
@@ -459,6 +461,24 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
<MomentTime data={post} />
</span>
</li>
+ {post.body && (
+ <>
+ <li className="list-inline-item">•</li>
+ <li className="list-inline-item">
+ {/* Using a link with tippy doesn't work on touch devices unfortunately */}
+ <Link
+ className="text-muted"
+ data-tippy-content={md.render(previewLines(post.body))}
+ data-tippy-allowHtml={true}
+ to={`/post/${post.id}`}
+ >
+ <svg class="mr-1 icon icon-inline">
+ <use xlinkHref="#icon-book-open"></use>
+ </svg>
+ </Link>
+ </li>
+ </>
+ )}
<li className="list-inline-item">•</li>
{this.state.upvotes !== this.state.score && (
<>