{"size": 1103, "ext": "js", "max_stars_repo_path": "src/components/CodeBlock/CodeBlock.js", "max_stars_repo_name": "neurotech/pocket-dimension", "max_stars_repo_stars_event_min_datetime": "2019-05-26T19:45:23.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-26T19:45:23.000Z", "max_issues_repo_path": "src/components/CodeBlock/CodeBlock.js", "max_issues_repo_name": "neurotech/pocket-dimension", "max_issues_repo_issues_event_min_datetime": "2019-01-29T04:53:41.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-14T00:50:14.000Z", "max_forks_repo_path": "src/components/CodeBlock/CodeBlock.js", "max_forks_repo_name": "neurotech/pocket-dimension", "max_forks_repo_forks_event_min_datetime": "2019-01-10T03:01:07.000Z", "max_forks_repo_forks_event_max_datetime": "2019-01-10T03:01:07.000Z"}
{"max_stars_count": 1, "max_issues_count": 24, "max_forks_count": 1, "avg_line_length": 36.7666666667, "max_line_length": 80, "alphanum_fraction": 0.7579329102}
import React from "react";
import { PrismAsyncLight as SyntaxHighlighter } from "react-syntax-highlighter";
import dark from "./dark-theme";
import light from "./light-theme";
import csharp from "react-syntax-highlighter/dist/esm/languages/prism/csharp";
import js from "react-syntax-highlighter/dist/esm/languages/prism/javascript";
import jsx from "react-syntax-highlighter/dist/esm/languages/prism/jsx";
import lua from "react-syntax-highlighter/dist/esm/languages/prism/lua";
import shell from "react-syntax-highlighter/dist/esm/languages/prism/bash";

SyntaxHighlighter.registerLanguage("csharp", csharp);
SyntaxHighlighter.registerLanguage("js", js);
SyntaxHighlighter.registerLanguage("javascript", js);
SyntaxHighlighter.registerLanguage("jsx", jsx);
SyntaxHighlighter.registerLanguage("lua", lua);
SyntaxHighlighter.registerLanguage("shell", shell);

const CodeBlock = ({ language, value, darkMode }) => {
  return (
    <SyntaxHighlighter
      language={language || "text"}
      style={darkMode ? dark : light}
    >
      {value}
    </SyntaxHighlighter>
  );
};

export default CodeBlock;
