diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2022-05-01 00:56:06 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2022-05-01 00:56:06 +0200 |
| commit | a7cf03c192470cbab13edeb1aec99e0c66dede10 (patch) | |
| tree | 581b4430d1de958dcb666bae80a7678332134602 /src/lib/components/post/post.svelte | |
| parent | 010f307346e525ac2e4239a0549d2c1a4d6d102b (diff) | |
Update / use typescript
Diffstat (limited to 'src/lib/components/post/post.svelte')
| -rw-r--r-- | src/lib/components/post/post.svelte | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/lib/components/post/post.svelte b/src/lib/components/post/post.svelte new file mode 100644 index 0000000..4e6c28f --- /dev/null +++ b/src/lib/components/post/post.svelte @@ -0,0 +1,50 @@ +<script lang="ts"> + export let post; + export let index = 0; + export let count = 1; + + import { _ } from 'svelte-i18n'; + import Glyph from '$lib/components/glyph/glyph.svelte'; + + const timestampToISO = (timestamp) => new Date(timestamp).toISOString(); +</script> + +<aside + class="post-meta" + title={$_('post.metadata_title', { values: { count: index + 1, total: count } })} +> + <Glyph uuid={post.author.id} /> + <span class="h-card"> + {$_('post.author_credit')} + <a href="/a/{post.author.handle}" class="p-nickname u-url">{post.author.handle}</a>. + </span> + <time role="presentation" class="dt-published" datetime={timestampToISO(post.created_at)}> + <a title={$_('post.permalink_title')} href="/p/{post.id}"> + {timestampToISO(post.created_at)} + </a> + </time> + {#if post.topic} + <span> + ({$_('post.topic_location')} <a href="/t/{post.topic.id}">{post.topic.title}</a>.) + </span> + {/if} +</aside> +<article + class="e-content" + title={$_('post.title', { + values: { count: index + 1, total: count, author: post.author.handle } + })} +> + {post.text} +</article> +<hr /> + +<style> + .post-meta * { + vertical-align: top; + } + + article { + white-space: pre; + } +</style> |