From 8f5278eb443864910dd9c2131c992d71e3af2d20 Mon Sep 17 00:00:00 2001
From: kartofen <mladenovnasko0@gmail.com>
Date: Fri, 26 Aug 2022 23:54:17 +0300
Subject: Big bang

---
 src/components/Comment.svelte | 45 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 src/components/Comment.svelte

(limited to 'src/components/Comment.svelte')

diff --git a/src/components/Comment.svelte b/src/components/Comment.svelte
new file mode 100644
index 0000000..09469cc
--- /dev/null
+++ b/src/components/Comment.svelte
@@ -0,0 +1,45 @@
+<script lang="ts">
+  import { creatorColor, formatTime } from '../lib/util';
+  import type Comment from '../models/Thread';
+  export let comment: Comment;
+</script>
+
+
+<div class="commentbox" id="{comment.id}">
+
+  <span style="line-height: 2rem;">
+    {comment.id}
+    at {formatTime(comment.creationDate)} <br>
+    ->  <span style="{creatorColor(comment.commentCreator)}">
+      {comment.commentCreator}
+    </span> <br>
+  </span>
+
+    {#if comment.imageId!= null && comment.imageId != undefined}
+      {#if comment.fileType == 'image'}
+        <a href="{comment.imageId}" target="_blank" rel="noopener noreferrer">
+          <img src="{comment.imageId}" alt="{comment.imageId}" height="300px" width="300px"> <br>
+        </a>
+      {:else if comment.fileType == 'video'}
+        <video width="320" height="240" controls muted>
+          <source src="{comment.imageId}">
+        </video>
+      {/if}
+    {/if}
+
+<p>{@html comment.commentText}</p>
+
+</div>
+
+<style>
+  .commentbox {
+    width: 500px;
+    border: 5px solid green;
+    padding: 10px;
+    margin: 10px;
+    background-color: white;
+  }
+  :target, .targeted {
+    background-color: #ffa;
+  }
+</style>
-- 
cgit v1.2.3

