2022-05-27 14:39:05 +03:00
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
|
|
import { a11yDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
|
|
|
|
|
|
export const CodeSnippetlighter = () => {
|
|
|
|
const [codeString, setCodeString] = useState(``)
|
2023-01-17 22:14:05 +03:00
|
|
|
//
|
|
|
|
// useEffect(()=>{
|
|
|
|
// fetch('/code.txt')
|
|
|
|
// .then((r) => r.text())
|
|
|
|
// .then(text => {
|
|
|
|
// setCodeString(text)
|
|
|
|
// })
|
|
|
|
// }, [])
|
2022-05-27 14:39:05 +03:00
|
|
|
|
|
|
|
return (
|
|
|
|
<SyntaxHighlighter language={"javascript"} style={a11yDark} wrapLongLines={false} customStyle={{fontSize:14}} showLineNumbers={true}>
|
|
|
|
{codeString}
|
|
|
|
</SyntaxHighlighter>
|
|
|
|
);
|
|
|
|
};
|