shack/pages/posts/post.page.vue

87 lines
1.3 KiB
Vue
Raw Normal View History

2023-06-11 03:32:02 +00:00
<template>
<Shelf :shelf="shelf">
2023-06-25 17:52:00 +00:00
<div class="content">
<Post
:post="post"
:shelf="shelf"
/>
<p
v-if="post.body"
class="body"
>{{ post.body }}</p>
<Writer
v-if="me"
:post="post"
/>
<div
v-else
class="body"
2023-06-11 03:32:02 +00:00
>
2023-06-25 17:52:00 +00:00
<a
href="/account/login"
class="link"
>Log in</a> or
<a
href="/account/create"
class="link"
>sign up</a> to comment
</div>
2023-06-11 03:32:02 +00:00
<ul class="comments nolist">
<li
v-for="comment in comments"
:key="comment.id"
2023-06-25 17:52:00 +00:00
>
<Comment
:comment="comment"
:post="post"
:shelf="shelf"
/>
</li>
2023-06-11 03:32:02 +00:00
</ul>
</div>
</Shelf>
2023-06-11 03:32:02 +00:00
</template>
<script setup>
import Shelf from '../../templates/shelves/shelf.vue';
2023-06-11 03:32:02 +00:00
import Post from '../../components/posts/post.vue';
import Comment from '../../components/comments/comment.vue';
2023-06-25 17:52:00 +00:00
import Writer from '../../components/comments/writer.vue';
2023-06-11 03:32:02 +00:00
import { usePageContext } from '../../renderer/usePageContext';
2023-06-25 17:52:00 +00:00
const { me, pageData } = usePageContext();
2023-06-11 03:32:02 +00:00
const {
shelf,
post,
comments,
} = pageData;
</script>
<style scoped>
2023-06-25 17:52:00 +00:00
.content {
width: 100%;
2023-06-11 03:32:02 +00:00
}
.body {
2023-06-25 17:52:00 +00:00
box-sizing: border-box;
padding: 1rem;
border-radius: .5rem;
margin: 0 0 .5rem 0;
background: var(--background);
2023-06-11 03:32:02 +00:00
}
2023-06-25 17:52:00 +00:00
.title {
margin: 0 0 .5rem 0;
2023-06-11 03:32:02 +00:00
}
2023-06-25 17:52:00 +00:00
.post {
2023-06-11 03:32:02 +00:00
margin-bottom: .5rem;
}
</style>