diff --git a/app/globals.css b/app/globals.css index c529701..018908e 100644 --- a/app/globals.css +++ b/app/globals.css @@ -33,18 +33,6 @@ 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); -} - /* Shiki Code-Blöcke stylen */ pre { padding: 1rem; @@ -94,6 +82,7 @@ figure[data-rehype-pretty-code-figure] code { font-family: var(--font-mono, monospace); } +/* Container für den Code-Block */ /* Container für den Code-Block */ figure[data-rehype-pretty-code-figure] { position: relative; @@ -101,22 +90,22 @@ figure[data-rehype-pretty-code-figure] { margin-bottom: 1.5rem; border-radius: 0.75rem; overflow: hidden; - border: 1px solid #27272a; /* Tailwind zinc-800 */ + border: 1px solid #27272a; background-color: #0d1117; } -/* Eventuelle leere Pseudo-Elemente der Figure deaktivieren */ +/* Leeres Pseudo-Element der Figure deaktivieren */ figure[data-rehype-pretty-code-figure]::before { display: none !important; } -/* Das Sprach-Badge ganz nach links rücken */ +/* Sprach-Badge links oben */ figure[data-rehype-pretty-code-figure] pre[data-language]::before { content: attr(data-language); display: block !important; position: absolute; top: 0.6rem; - left: 0.6rem; /* <-- Auf 0.5rem (oder 0.4rem) verringert für noch weiter links */ + left: 0.5rem; font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.68rem; font-weight: 600; @@ -128,14 +117,14 @@ figure[data-rehype-pretty-code-figure] pre[data-language]::before { padding: 0.15rem 0.5rem; border-radius: 0.375rem; pointer-events: none; - z-index: 20; + z-index: 10; } -/* Platz oben für das Badge schaffen */ +/* Platz oben im Code-Block */ figure[data-rehype-pretty-code-figure] pre { margin: 0 !important; padding: 1rem !important; - padding-top: 2.4rem !important; /* Genügend Abstand nach oben */ + padding-top: 2.6rem !important; /* Platz für Badge & Button */ background-color: transparent !important; overflow-x: auto; font-size: 0.875rem; diff --git a/app/wiki/[slug]/page.tsx b/app/wiki/[slug]/page.tsx index 6bad611..619bada 100644 --- a/app/wiki/[slug]/page.tsx +++ b/app/wiki/[slug]/page.tsx @@ -2,7 +2,7 @@ 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'; +import { Callout, Grid, Card, Steps, Step, InlineCode, CodeBlockContainer } from '@/components/mdx-components'; const mdxOptions = { mdxOptions: { @@ -25,9 +25,9 @@ const mdxComponents = { Card, Steps, Step, - // Custom Typography Überschreibungen code: InlineCode, + pre: CodeBlockContainer, h1: (props: any) =>
, h2: (props: any) => , h3: (props: any) => , diff --git a/components/CopyButton.tsx b/components/CopyButton.tsx new file mode 100644 index 0000000..6f88bd8 --- /dev/null +++ b/components/CopyButton.tsx @@ -0,0 +1,45 @@ +'use client'; + +import { useState } from 'react'; + +export function CopyButton({ code }: { code?: string }) { + const [copied, setCopied] = useState(false); + + const handleCopy = async (e: React.MouseEvent{children}
+