This repository has been archived on 2024-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
Frontend/src/app/components/codeBlock.tsx
Liam 8ce1c1baf9
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m1s
Publish Docker Image / docker (ubuntu-latest) (push) Successful in 50s
fix codeblock
2024-04-23 04:45:15 +01:00

31 lines
776 B
TypeScript

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