Przymiarka do dokumentów

This commit is contained in:
dm
2025-12-13 13:37:27 +01:00
parent 53ef126303
commit 9caf91fbfb
7 changed files with 260 additions and 15 deletions

View File

@@ -0,0 +1,32 @@
---
import DefaultLayout from "../../layouts/DefaultLayout.astro";
import Markdown from "../../islands/Markdown.jsx";
import { marked } from "marked";
import { getDocumentBySlug } from "../../lib/documents";
const { slug } = Astro.params;
const doc = slug ? getDocumentBySlug(slug) : null;
if (!doc || doc.visible !== true) {
return Astro.redirect("/dokumenty", 302);
}
const html = marked.parse(doc.content);
---
<DefaultLayout title={doc.title}>
<section class="max-w-4xl mx-auto px-4 py-10">
<a href="/dokumenty" class="text-sm opacity-70 hover:opacity-100">
← Wróć do dokumentów
</a>
<h1 class="mt-4 text-4xl md:text-5xl font-bold text-[--f-header]">
{doc.title}
</h1>
<article class="mt-8 prose max-w-none">
<Markdown text={html} />
<!-- <div set:html={html} /> -->
</article>
</section>
</DefaultLayout>