Basic post display
This commit is contained in:
31
src/lib/components/PostComponent.svelte
Normal file
31
src/lib/components/PostComponent.svelte
Normal file
@ -0,0 +1,31 @@
|
||||
<script lang="ts">
|
||||
import type { Post } from '$lib/mastodon/response';
|
||||
import AvatarComponent from '$lib/components/AvatarComponent.svelte';
|
||||
import AccountComponent from '$lib/components/AccountComponent.svelte';
|
||||
|
||||
export let post: Post;
|
||||
let dateCreated: string;
|
||||
$: dateCreated = new Date(post.created_at).toLocaleString();
|
||||
</script>
|
||||
|
||||
<div class="wrapper">
|
||||
<div class="avatar"><AvatarComponent account={post.account} /></div>
|
||||
<div class="post">
|
||||
<AccountComponent account={post.account} />
|
||||
<small><a href={post.url} target="_blank">{dateCreated}</a></small>
|
||||
{@html post.content}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.wrapper {
|
||||
display: flex;
|
||||
}
|
||||
.post {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.avatar {
|
||||
margin-right: 1em;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user