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
commit57d49955973c94da59b83075a212be4cad7078eb (patch)
treee95b0ead1d565f38242af57399d20ba5ed56e905 /extension/react-app/src/components/StyledCode.tsx
parentd45ce41f6476a96cd0e4d375f7cd00393865d9cf (diff)
parentd2842f655c4d02952d8cf58ec3a2c927704cabae (diff)
downloadsncontinue-57d49955973c94da59b83075a212be4cad7078eb.tar.gz
sncontinue-57d49955973c94da59b83075a212be4cad7078eb.tar.bz2
sncontinue-57d49955973c94da59b83075a212be4cad7078eb.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;