fix: remove code block language label overlap, add diagram zoom/pan/fullscreen

- Remove 'bash' language label that overlapped with code text
- Add zoom (scroll), pan (drag), and fullscreen toggle to Mermaid diagrams
- Fullscreen mode with dark overlay, controls toolbar, and Esc to close
- Zoom percentage indicator and reset button
This commit is contained in:
Vectry
2026-02-09 18:45:47 +00:00
parent 31be269aab
commit dd03d86642
2 changed files with 175 additions and 24 deletions

View File

@@ -20,7 +20,6 @@ export function CodeBlock({ children, className, inline }: CodeBlockProps) {
);
}
const language = className?.replace("language-", "") || "";
const codeString = String(children).replace(/\n$/, "");
const handleCopy = async () => {
@@ -31,11 +30,6 @@ export function CodeBlock({ children, className, inline }: CodeBlockProps) {
return (
<div className="relative group my-4">
{language && (
<div className="absolute top-0 left-0 px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-zinc-500 bg-black/30 rounded-tl-lg rounded-br-lg border-b border-r border-white/5">
{language}
</div>
)}
<button
onClick={handleCopy}
className="absolute top-2 right-2 p-1.5 rounded-md bg-white/5 border border-white/10 text-zinc-500 hover:text-white hover:bg-white/10 transition-all opacity-0 group-hover:opacity-100 z-10"
@@ -47,7 +41,7 @@ export function CodeBlock({ children, className, inline }: CodeBlockProps) {
<Copy className="w-3.5 h-3.5" />
)}
</button>
<pre className="overflow-x-auto rounded-lg bg-black/50 border border-white/10 p-4 pt-8 text-sm leading-relaxed font-mono scrollbar-thin">
<pre className="overflow-x-auto rounded-lg bg-black/50 border border-white/10 p-4 text-sm leading-relaxed font-mono scrollbar-thin">
<code className={`text-zinc-300 ${className || ""}`}>{codeString}</code>
</pre>
</div>