shack/pages/posts/post.page.vue

102 lines
1.4 KiB
Vue
Raw Normal View History

2023-06-11 03:32:02 +00:00
<template>
<div class="page">
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>
<div class="sidebar">
{{ shelf.name }}
</div>
</div>
</template>
<script setup>
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>
.page {
display: flex;
}
2023-06-25 17:52:00 +00:00
.content {
flex-grow: 1;
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;
}
.sidebar {
background: var(--background);
width: 20rem;
padding: .5rem;
border-radius: .5rem;
margin-left: .5rem;
}
</style>