summaryrefslogtreecommitdiff
path: root/extension/react-app/src/components/StyledCode.tsx
blob: c5ed010147f9e0a337a894406f9f7847212544fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { vscDarkPlus as highlightStyle } from "react-syntax-highlighter/dist/esm/styles/prism";

interface StyledCodeProps {
  children: string;
  language?: string;
}

const StyledCode = (props: StyledCodeProps) => (
  <SyntaxHighlighter
    customStyle={{ margin: "0" }}
    style={highlightStyle}
    language={props.language || "python"}
  >
    {props.children}
  </SyntaxHighlighter>
);

export default StyledCode;