]> Untitled Git - lemmy.git/commitdiff
Adding a link overlay. Fixes #549
authorDessalines <tyhou13@gmx.com>
Fri, 21 Feb 2020 16:26:42 +0000 (11:26 -0500)
committerDessalines <tyhou13@gmx.com>
Fri, 21 Feb 2020 16:26:42 +0000 (11:26 -0500)
ui/assets/css/main.css
ui/src/components/post-listing.tsx

index e7784877bc2046a0f8b3878d7c31f4d8cff5b294..0002017730d0c298dd45e4ce6f0ee0def986b154 100644 (file)
@@ -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;
+}
index c0ddedc185e06b86b356bc703047ad85e89c6c0f..b3bde27feb97b7a36a654d295f5ec5c0f6c0cb9d 100644 (file)
@@ -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