forked from nutomic/lemmy
Adding a link overlay. Fixes #549
This commit is contained in:
parent
6cde97836b
commit
c896e01b9e
2 changed files with 34 additions and 12 deletions
10
ui/assets/css/main.css
vendored
10
ui/assets/css/main.css
vendored
|
@ -187,3 +187,13 @@ hr {
|
||||||
color: var(--white);
|
color: var(--white);
|
||||||
border: unset;
|
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;
|
||||||
|
}
|
||||||
|
|
14
ui/src/components/post-listing.tsx
vendored
14
ui/src/components/post-listing.tsx
vendored
|
@ -162,18 +162,30 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{this.hasImage() && !this.state.imageExpanded && (
|
{this.hasImage() && !this.state.imageExpanded && (
|
||||||
|
<div class="mx-2 mt-1 float-left position-relative">
|
||||||
<span
|
<span
|
||||||
title={i18n.t('expand_here')}
|
title={i18n.t('expand_here')}
|
||||||
class="pointer"
|
class="pointer"
|
||||||
onClick={linkEvent(this, this.handleImageExpandClick)}
|
onClick={linkEvent(this, this.handleImageExpandClick)}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className={`mx-2 mt-1 float-left img-fluid thumbnail rounded ${(post.nsfw ||
|
className={`img-fluid thumbnail rounded ${(post.nsfw ||
|
||||||
post.community_nsfw) &&
|
post.community_nsfw) &&
|
||||||
'img-blur'}`}
|
'img-blur'}`}
|
||||||
src={imageThumbnailer(this.getImage())}
|
src={imageThumbnailer(this.getImage())}
|
||||||
/>
|
/>
|
||||||
</span>
|
</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) && (
|
{this.state.url && isVideo(this.state.url) && (
|
||||||
<video
|
<video
|
||||||
|
|
Loading…
Reference in a new issue