]>
Commit | Line | Data |
---|---|---|
a7cf03c1 | 1 | <script lang="ts"> |
be1ce532 RBR |
2 | import type { Post } from '$lib/data/types'; |
3 | ||
4 | export let post: Post; | |
58f7d521 RBR |
5 | export let index = 0; |
6 | export let count = 1; | |
c458f273 | 7 | |
58f7d521 | 8 | import { _ } from 'svelte-i18n'; |
a7cf03c1 | 9 | import Glyph from '$lib/components/glyph/glyph.svelte'; |
bd8e98d7 | 10 | |
be1ce532 | 11 | const timestampToISO = (timestamp: number) => new Date(timestamp).toISOString(); |
c458f273 | 12 | </script> |
24be7b53 | 13 | |
58f7d521 RBR |
14 | <aside |
15 | class="post-meta" | |
16 | title={$_('post.metadata_title', { values: { count: index + 1, total: count } })} | |
17 | > | |
852ee620 | 18 | <Glyph uuid={post.author_id} /> |
6ccc6f60 RBR |
19 | {#if post.author} |
20 | <span class="h-card"> | |
21 | {$_('post.author_credit')} | |
22 | <a | |
23 | href="/a/{post.author.handle}" | |
24 | class="p-nickname u-url underline text-blue-600 visited:text-purple-500" | |
25 | >{post.author.handle}</a | |
26 | >. | |
27 | </span> | |
28 | {:else} | |
29 | <span>????</span> | |
30 | {/if} | |
58f7d521 | 31 | <time role="presentation" class="dt-published" datetime={timestampToISO(post.created_at)}> |
6ccc6f60 RBR |
32 | <a |
33 | title={$_('post.permalink_title')} | |
34 | class="underline text-blue-600 visited:text-purple-500" | |
35 | href="/p/{post.id}" | |
36 | > | |
58f7d521 RBR |
37 | {timestampToISO(post.created_at)} |
38 | </a> | |
39 | </time> | |
cac85db0 RBR |
40 | {#if post.topic} |
41 | <span> | |
6ccc6f60 RBR |
42 | ({$_('post.topic_location')} |
43 | <a class="text-blue-600 underline visited:text-purple-500" href="/t/{post.topic.id}" | |
44 | >{post.topic.title}</a | |
45 | >.) | |
cac85db0 RBR |
46 | </span> |
47 | {/if} | |
58f7d521 RBR |
48 | </aside> |
49 | <article | |
852ee620 | 50 | class="e-content whitespace-pre" |
58f7d521 | 51 | title={$_('post.title', { |
6ccc6f60 | 52 | values: { count: index + 1, total: count, author: post.author?.handle || '????' } |
58f7d521 RBR |
53 | })} |
54 | > | |
55 | {post.text} | |
56 | </article> | |
57 | <hr /> | |
58 | ||
59 | <style> | |
60 | .post-meta * { | |
61 | vertical-align: top; | |
62 | } | |
63 | ||
64 | article { | |
65 | white-space: pre; | |
66 | } | |
67 | </style> |