Skip to content

Commit

Permalink
Adding a link overlay. Fixes LemmyNet#549
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines committed Feb 21, 2020
1 parent 883c8de commit 2dec9b5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
10 changes: 10 additions & 0 deletions ui/assets/css/main.css
Expand Up @@ -187,3 +187,13 @@ hr {
color: var(--white);
border: unset;
}

.link-overlay {
position: absolute;
top: 0;
right: 0;
padding: 2px;
background: rgba(0,0,0,.4);
border-bottom-left-radius: 0.25rem !important;
border-top-right-radius: 0.25rem !important;
}
36 changes: 24 additions & 12 deletions ui/src/components/post-listing.tsx
Expand Up @@ -162,18 +162,30 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
)}
</div>
{this.hasImage() && !this.state.imageExpanded && (
<span
title={i18n.t('expand_here')}
class="pointer"
onClick={linkEvent(this, this.handleImageExpandClick)}
>
<img
className={`mx-2 mt-1 float-left img-fluid thumbnail rounded ${(post.nsfw ||
post.community_nsfw) &&
'img-blur'}`}
src={imageThumbnailer(this.getImage())}
/>
</span>
<div class="mx-2 mt-1 float-left position-relative">
<span
title={i18n.t('expand_here')}
class="pointer"
onClick={linkEvent(this, this.handleImageExpandClick)}
>
<img
className={`img-fluid thumbnail rounded ${(post.nsfw ||
post.community_nsfw) &&
'img-blur'}`}
src={imageThumbnailer(this.getImage())}
/>
</span>
<a
className="text-body"
href={this.state.url}
target="_blank"
title={this.state.url}
>
<svg class="icon link-overlay">
<use xlinkHref="#icon-external-link"></use>
</svg>
</a>
</div>
)}
{this.state.url && isVideo(this.state.url) && (
<video
Expand Down

0 comments on commit 2dec9b5

Please sign in to comment.