memex-in commited on
Commit
429cdc2
·
verified ·
1 Parent(s): 915dd17

Create components/CodeBlock.js

Browse files
Files changed (1) hide show
  1. 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
+ }