-
-
Save brunosabot/983ed6698517b94caff8f884a3f56dd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import classes from "./Post.module.css"; | |
import Prism from "react-syntax-highlighter/dist/cjs/prism"; | |
interface IGistProps { | |
lang: string; | |
file?: string; | |
code: string; | |
} | |
const Gist: React.FC<IGistProps> = ({ lang, file, code }) => { | |
return ( | |
<> | |
{file ? ( | |
<div className={classes["blog-post-gist-filename"]}>{file}</div> | |
) : null} | |
<Prism | |
language={lang === "" ? "text" : lang} | |
showLineNumbers={lang !== "text"} | |
wrapLines | |
wrapLongLines={lang === "text"} | |
> | |
{code} | |
</Prism> | |
</> | |
); | |
}; | |
export default Gist; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment