diff --git a/app/globals.css b/app/globals.css index a5a7660..f7089b7 100644 --- a/app/globals.css +++ b/app/globals.css @@ -32,3 +32,15 @@ section { h1 { font-size: 2rem; } + +.steps-container { + counter-reset: step; +} + +.steps-container .relative { + counter-increment: step; +} + +.steps-container .relative div:first-child::before { + content: counter(step); +} \ No newline at end of file diff --git a/app/wiki/[slug]/page.tsx b/app/wiki/[slug]/page.tsx index f7d27bf..d07f7a8 100644 --- a/app/wiki/[slug]/page.tsx +++ b/app/wiki/[slug]/page.tsx @@ -2,10 +2,15 @@ import { getWikiPageBySlug } from '@/lib/wiki'; import { notFound } from 'next/navigation'; import { MDXRemote } from 'next-mdx-remote/rsc'; -import { Callout } from '@/components/markdown/Callout'; +import { Callout, Grid, Card, Steps, Step } from '@/components/mdx-components'; -const components = { +const mdxComponents = { Callout, + Grid, + Card, + Steps, + Step, + h2: (props: any) =>

, }; type PageProps = { @@ -26,7 +31,7 @@ export default async function Page({ params }: PageProps) {

{article.title}

{/* Direkte MDX-Rendering-Komponente von Next.js */} - +
); } \ No newline at end of file diff --git a/components/markdown/Callout.tsx b/components/markdown/Callout.tsx deleted file mode 100644 index ce52fac..0000000 --- a/components/markdown/Callout.tsx +++ /dev/null @@ -1,11 +0,0 @@ -export function Callout({ children, type = 'info' }: { children: React.ReactNode; type?: 'info' | 'warning' }) { - const styles = type === 'warning' - ? 'bg-amber-500/10 border-amber-500 text-amber-200' - : 'bg-blue-500/10 border-blue-500 text-blue-200'; - - return ( -
- {children} -
- ); -} \ No newline at end of file diff --git a/components/mdx-components.tsx b/components/mdx-components.tsx new file mode 100644 index 0000000..5f4d2cd --- /dev/null +++ b/components/mdx-components.tsx @@ -0,0 +1,58 @@ +import React from 'react'; + +// 1. Callout (Info, Warning, Error) +export function Callout({ children, type = 'info' }: { children: React.ReactNode, type?: 'info' | 'warning' | 'error' | 'success' }) { + const variants = { + info: "bg-blue-500/10 border-blue-500 text-blue-200", + warning: "bg-amber-500/10 border-amber-500 text-amber-200", + error: "bg-red-500/10 border-red-500 text-red-200", + success: "bg-emerald-500/10 border-emerald-500 text-emerald-200", + }; + + return ( +
+
+
+ {type === 'info' && } + {type === 'warning' && } +
+
{children}
+
+
+ ); +} + +// 2. Card Grid (Für Übersichtsseiten) +export function Grid({ children }: { children: React.ReactNode }) { + return
{children}
; +} + +export function Card({ title, href, children }: { title: string, href: string, children: React.ReactNode }) { + return ( + +

{title}

+

{children}

+
+ ); +} + +// 3. Steps (Für nummerierte Anleitungen) +export function Steps({ children }: { children: React.ReactNode }) { + return ( +
+ {children} +
+ ); +} + +export function Step({ title, children }: { title: string, children: React.ReactNode }) { + return ( +
+
+ {/* Die Nummerierung macht CSS automatisch, siehe unten */} +
+

{title}

+
{children}
+
+ ); +} \ No newline at end of file diff --git a/data/wiki/pages/test.mdx b/data/wiki/pages/test.mdx new file mode 100644 index 0000000..701e7b3 --- /dev/null +++ b/data/wiki/pages/test.mdx @@ -0,0 +1,35 @@ +--- +title: Projekt Starten +--- + +# Willkommen im Wiki + + + + Erfahre, wie du das Projekt lokal aufsetzt. + + + So bringst du deinen Code live auf den Server. + + + +## Schnellstart + + + + Nutze Git, um den Code zu holen: + `git clone ...` + + + Führe den Installer aus: + `npm install` + + + + + Vergiss nicht, die `.env` Datei anzulegen, sonst startet die App nicht! + + + + Du bist jetzt bereit zum Entwickeln! + \ No newline at end of file