Ratings
This commit is contained in:
parent
2781724f8f
commit
b36379c044
@ -1,13 +1,18 @@
|
||||
<script>
|
||||
import Rating from "./rating.svelte";
|
||||
|
||||
/**
|
||||
* @type {import("$types/base").CommentTreeNode}
|
||||
*/
|
||||
export let commentNode;
|
||||
|
||||
$: comment = commentNode.parent;
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<h5>{commentNode.parent.author?.name}</h5>
|
||||
<p>{commentNode.parent.content}</p>
|
||||
<h5>{comment.author?.name}</h5>
|
||||
<Rating rating={comment.rating}></Rating>
|
||||
<p>{comment.content}</p>
|
||||
<div>
|
||||
{#each commentNode.children as reply}
|
||||
<svelte:self commentNode={reply}></svelte:self>
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<script>
|
||||
import Rating from './rating.svelte';
|
||||
|
||||
/**
|
||||
* @type {import('$types/base').Post}
|
||||
*/
|
||||
@ -7,6 +9,8 @@
|
||||
|
||||
<div>
|
||||
<a href="/posts/{post.id}">{post.name}</a>
|
||||
<!-- <p>{post.author.name}</p> -->
|
||||
<p>{post.author?.name}</p>
|
||||
<p>{post.category.name}</p>
|
||||
<Rating rating={post.rating}></Rating>
|
||||
<p>{post.content}</p>
|
||||
</div>
|
||||
|
||||
11
src/comp/rating.svelte
Normal file
11
src/comp/rating.svelte
Normal file
@ -0,0 +1,11 @@
|
||||
<script>
|
||||
/**
|
||||
* @type {import("$types/base").Rating}
|
||||
*/
|
||||
export let rating;
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<p>up: {rating.likes}</p>
|
||||
<p>down: {rating.dislikes}</p>
|
||||
</div>
|
||||
Loading…
x
Reference in New Issue
Block a user