Create components/CodeBlock.js
Browse files- components/CodeBlock.js +10 -0
components/CodeBlock.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter';
|
2 |
+
import { vs2015 } from 'react-syntax-highlighter/dist/cjs/styles/hljs'; // Or any other style you like
|
3 |
+
|
4 |
+
export default function CodeBlock({ code, language = 'javascript' }) {
|
5 |
+
return (
|
6 |
+
<SyntaxHighlighter language={language} style={vs2015}>
|
7 |
+
{code}
|
8 |
+
</SyntaxHighlighter>
|
9 |
+
);
|
10 |
+
}
|