style: add more components and add test wiki page
This commit is contained in:
1 parent
fd4da2a43f
commit
3d82ef9671
5 files changed
+113
-14
No files matched your search
@@ -32,3 +32,15 @@ section {
|
|||||||
h1 {
|
h1 {
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.steps-container {
|
||||||
|
counter-reset: step;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps-container .relative {
|
||||||
|
counter-increment: step;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps-container .relative div:first-child::before {
|
||||||
|
content: counter(step);
|
||||||
|
}
|
||||||
@@ -2,10 +2,15 @@ import { getWikiPageBySlug } from '@/lib/wiki';
|
|||||||
import { notFound } from 'next/navigation';
|
import { notFound } from 'next/navigation';
|
||||||
|
|
||||||
import { MDXRemote } from 'next-mdx-remote/rsc';
|
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,
|
Callout,
|
||||||
|
Grid,
|
||||||
|
Card,
|
||||||
|
Steps,
|
||||||
|
Step,
|
||||||
|
h2: (props: any) => <h2 className="text-2xl font-bold text-white mt-12 mb-4" {...props} />,
|
||||||
};
|
};
|
||||||
|
|
||||||
type PageProps = {
|
type PageProps = {
|
||||||
@@ -26,7 +31,7 @@ export default async function Page({ params }: PageProps) {
|
|||||||
<article className="prose prose-invert max-w-none p-6">
|
<article className="prose prose-invert max-w-none p-6">
|
||||||
<h1>{article.title}</h1>
|
<h1>{article.title}</h1>
|
||||||
{/* Direkte MDX-Rendering-Komponente von Next.js */}
|
{/* Direkte MDX-Rendering-Komponente von Next.js */}
|
||||||
<MDXRemote source={article.rawContent} components={components} />
|
<MDXRemote source={article.rawContent} components={mdxComponents} />
|
||||||
</article>
|
</article>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -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 (
|
|
||||||
<div className={`p-4 my-4 rounded-lg border-l-4 ${styles}`}>
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -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 (
|
||||||
|
<div className={`p-4 my-6 rounded-xl border-l-4 ${variants[type]}`}>
|
||||||
|
<div className="flex gap-3">
|
||||||
|
<div className="mt-1">
|
||||||
|
{type === 'info' && <svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>}
|
||||||
|
{type === 'warning' && <svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /></svg>}
|
||||||
|
</div>
|
||||||
|
<div className="text-sm leading-relaxed">{children}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Card Grid (Für Übersichtsseiten)
|
||||||
|
export function Grid({ children }: { children: React.ReactNode }) {
|
||||||
|
return <div className="grid grid-cols-1 md:grid-cols-2 gap-4 my-8">{children}</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Card({ title, href, children }: { title: string, href: string, children: React.ReactNode }) {
|
||||||
|
return (
|
||||||
|
<a href={href} className="block p-6 bg-zinc-900 border border-zinc-800 rounded-xl hover:border-blue-500 transition-colors group">
|
||||||
|
<h3 className="text-lg font-bold text-white group-hover:text-blue-400 m-0 mb-2">{title}</h3>
|
||||||
|
<p className="text-zinc-400 text-sm m-0 leading-relaxed">{children}</p>
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Steps (Für nummerierte Anleitungen)
|
||||||
|
export function Steps({ children }: { children: React.ReactNode }) {
|
||||||
|
return (
|
||||||
|
<div className="steps-container ml-4 border-l border-zinc-800 pl-8 my-8 space-y-8">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Step({ title, children }: { title: string, children: React.ReactNode }) {
|
||||||
|
return (
|
||||||
|
<div className="relative">
|
||||||
|
<div className="absolute -left-[41px] flex h-5 w-5 items-center justify-center rounded-full bg-zinc-900 border border-zinc-800 text-[10px] font-bold text-white">
|
||||||
|
{/* Die Nummerierung macht CSS automatisch, siehe unten */}
|
||||||
|
</div>
|
||||||
|
<h3 className="text-white font-bold mb-2 mt-0">{title}</h3>
|
||||||
|
<div className="text-zinc-400 text-sm">{children}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
title: Projekt Starten
|
||||||
|
---
|
||||||
|
|
||||||
|
# Willkommen im Wiki
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Card title="Installation" href="/wiki/installation">
|
||||||
|
Erfahre, wie du das Projekt lokal aufsetzt.
|
||||||
|
</Card>
|
||||||
|
<Card title="Deployment" href="/wiki/deployment">
|
||||||
|
So bringst du deinen Code live auf den Server.
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
## Schnellstart
|
||||||
|
|
||||||
|
<Steps>
|
||||||
|
<Step title="Repository klonen">
|
||||||
|
Nutze Git, um den Code zu holen:
|
||||||
|
`git clone ...`
|
||||||
|
</Step>
|
||||||
|
<Step title="Abhängigkeiten installieren">
|
||||||
|
Führe den Installer aus:
|
||||||
|
`npm install`
|
||||||
|
</Step>
|
||||||
|
</Steps>
|
||||||
|
|
||||||
|
<Callout type="warning">
|
||||||
|
Vergiss nicht, die `.env` Datei anzulegen, sonst startet die App nicht!
|
||||||
|
</Callout>
|
||||||
|
|
||||||
|
<Callout type="success">
|
||||||
|
Du bist jetzt bereit zum Entwickeln!
|
||||||
|
</Callout>
|
||||||
Reference in new issue
Block a user