Browse Source

Show attached photos

Carsten Porth 5 years ago
parent
commit
69010a2028

+ 1 - 0
app/src/components/tweet-body/tweet-body.html

@@ -1,4 +1,5 @@
 <!-- Generated template for the TweetBodyComponent component -->
 <div>
   <p [innerHTML]="text | replaceUrls: entities.urls | replaceHashtags: entities.hashtags"></p>
+  <img *ngIf="hasPhoto" src="{{ entities.media[0]['media_url_https'] }}" alt="Photo" class="photo">
 </div>

+ 7 - 2
app/src/components/tweet-body/tweet-body.scss

@@ -1,3 +1,8 @@
 tweet-body {
-
-}
+    .photo {
+        margin-top: 5px;
+        padding: 2px;
+        border-radius: 3px;
+        border: 1px solid #dfdfdf;
+    }
+}

+ 4 - 0
app/src/components/tweet-body/tweet-body.ts

@@ -17,4 +17,8 @@ export class TweetBodyComponent {
 
   constructor() {}
 
+  get hasPhoto() {
+    return this.entities["media"] && this.entities["media"][0]["type"] == 'photo';
+  }
+
 }