summaryrefslogtreecommitdiff
path: root/extension/react-app/src/components/StyledCode.tsx
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-06-27 11:17:26 -0700
committerNate Sesti <sestinj@gmail.com>2023-06-27 11:17:26 -0700
commitc3106d3540efbf48de694ac9b9294d56b520493a (patch)
treed5923db2a1151517181f0a26ee32a3a873e019f9 /extension/react-app/src/components/StyledCode.tsx
parentbedd5f31e7a1d7b915fbb2a47a92f58035c96415 (diff)
parent3a39f7029f7faf5c77d4678ce6d796e4c99b558b (diff)
downloadsncontinue-c3106d3540efbf48de694ac9b9294d56b520493a.tar.gz
sncontinue-c3106d3540efbf48de694ac9b9294d56b520493a.tar.bz2
sncontinue-c3106d3540efbf48de694ac9b9294d56b520493a.zip
Merge branch 'main' into newer-simpler-stream-algo
Diffstat (limited to 'extension/react-app/src/components/StyledCode.tsx')
-rw-r--r--extension/react-app/src/components/StyledCode.tsx19
1 files changed, 19 insertions, 0 deletions
diff --git a/extension/react-app/src/components/StyledCode.tsx b/extension/react-app/src/components/StyledCode.tsx
new file mode 100644
index 00000000..c5ed0101
--- /dev/null
+++ b/extension/react-app/src/components/StyledCode.tsx
@@ -0,0 +1,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;