소스 검색

Show attached photos

Carsten Porth 6 년 전
부모
커밋
69010a2028
3개의 변경된 파일12개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 0
      app/src/components/tweet-body/tweet-body.html
  2. 7 2
      app/src/components/tweet-body/tweet-body.scss
  3. 4 0
      app/src/components/tweet-body/tweet-body.ts

+ 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';
+  }
+
 }