fix codeblocks
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m32s
Publish Docker Image / docker (ubuntu-latest) (push) Successful in 1m31s

This commit is contained in:
Lee
2024-04-23 04:24:13 +01:00
parent 5c81abedb4
commit 33f390ca92
5 changed files with 35 additions and 47 deletions

View File

@ -0,0 +1,33 @@
import { ReactElement } from "react";
import SyntaxHighlighter from "react-syntax-highlighter";
import { atomOneDark } from "react-syntax-highlighter/dist/esm/styles/hljs";
import { cn } from "@/app/common/utils";
import { jetbrainsMono } from "@/app/common/font/font";
type CodeBlockProps = {
/**
* The code to highlight.
*/
code: string;
};
export function CodeBlock({ code }: CodeBlockProps): ReactElement {
return (
<SyntaxHighlighter
className="break-all !bg-transparent text-xs"
style={atomOneDark}
wrapLongLines
showLineNumbers
PreTag={"div"}
codeTagProps={{
style: {
fontFamily: jetbrainsMono.style.fontFamily,
fontWeight: jetbrainsMono.style.fontWeight,
fontStyle: jetbrainsMono.style.fontStyle,
},
}}
>
{code}
</SyntaxHighlighter>
);
}