Files
psalmtafel-webservice/app/wiki/[slug]/page.tsx
T
2026-08-04 16:02:02 +02:00

66 lines
1.7 KiB
TypeScript

import { getWikiPageBySlug } from '@/lib/wiki';
import { notFound } from 'next/navigation';
import { MDXRemote } from 'next-mdx-remote/rsc';
import rehypePrettyCode from 'rehype-pretty-code';
import { Callout, Grid, Card, Steps, Step, InlineCode } from '@/components/mdx-components';
const mdxOptions = {
mdxOptions: {
rehypePlugins: [
[
rehypePrettyCode,
{
theme: 'github-dark',
keepBackground: true,
},
],
],
},
};
const mdxComponents = {
// Eigene UI-Komponenten
Callout,
Grid,
Card,
Steps,
Step,
// Custom Typography Überschreibungen
code: InlineCode,
h1: (props: any) => <h1 className="text-3xl font-bold text-white mt-8 mb-4 border-b border-zinc-800 pb-3" {...props} />,
h2: (props: any) => <h2 className="text-2xl font-bold text-white mt-10 mb-4" {...props} />,
h3: (props: any) => <h3 className="text-xl font-semibold text-white mt-6 mb-3" {...props} />,
};
type PageProps = {
params: Promise<{
slug: string;
}>;
};
export default async function Page({ params }: PageProps) {
const { slug } = await params;
const article = await getWikiPageBySlug(slug);
if (!article) {
notFound();
}
return (
<article className="prose prose-invert prose-blue max-w-4xl mx-auto p-6 md:p-12 min-h-screen">
<header className="mb-8 border-b border-zinc-800 pb-6">
<h1 className="text-4xl font-extrabold text-white mb-2 m-0">{article.title}</h1>
{article.updatedAt && (
<p className="text-zinc-500 text-sm m-0">Zuletzt aktualisiert: {article.updatedAt}</p>
)}
</header>
<MDXRemote
source={article.rawContent}
components={mdxComponents}
options={mdxOptions as any}
/>
</article>
);
}