tonybark.com/src/routes/[rkey]/+page.svelte

33 lines
985 B
Svelte
Raw Normal View History

2024-12-04 06:24:56 -08:00
<script lang="ts">
2024-12-17 12:37:47 -08:00
import { CommentSection } from "bluesky-comments-svelte";
2024-12-04 06:24:56 -08:00
import type { Post } from '$lib/parser.ts';
2024-12-17 12:37:47 -08:00
import { PUBLIC_HANDLE } from "$env/static/public";
2024-12-04 06:24:56 -08:00
2024-12-03 10:07:06 -08:00
let { data } = $props();
2024-12-04 06:24:56 -08:00
let post: Post | undefined = $state(undefined)
if ( data.posts.has(data.rkey)) {
post = data.posts.get(data.rkey) as Post
}
2024-12-03 10:07:06 -08:00
</script>
2024-12-04 06:24:56 -08:00
2024-12-03 10:07:06 -08:00
<svelte:head>
2024-12-04 06:24:56 -08:00
{#if post !== undefined}
<title>{post.title} - WhiteBreeze</title>
{:else}
<title>WhiteBreeze</title>
{/if}
2024-12-17 12:37:47 -08:00
<!-- <meta name="description" content="This is where the description goes for SEO" /> -->
2024-12-03 10:07:06 -08:00
</svelte:head>
2024-12-04 06:24:56 -08:00
{#if post !== undefined}
<h1 class="text-center my-4">{post.title}</h1>
<hr class="my-4">
2024-12-04 06:24:56 -08:00
<article class="mx-auto max-w-4xl px-2 sm:px-6 lg:px-8 prose dark:prose-invert">
{@html post.content}
</article>
<hr class="my-4">
2024-12-17 12:37:47 -08:00
<CommentSection author={PUBLIC_HANDLE} />
2024-12-04 06:24:56 -08:00
{:else}
<h1 class="text-center pt-4 pb-4">No such post</h1>
{/if}