<script>
    import { getNamedId } from '$lib/util';
    import Rating from './rating.svelte';

  /**
   * @type {import('$types/base').Post}
   */
  export let post;
</script>

<div>
  <a href="/posts/{getNamedId(post.id, post.name)}">{post.name}</a>
  <p>{post.author?.name}</p>
  <p>{post.category.name}</p>
  <Rating rating={post.rating}></Rating>
  <p>{post.content}</p>
</div>
