Skip to content

Commit

Permalink
feat: Update code block component (#1279)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWitt committed Nov 23, 2023
1 parent d0df0de commit 57d5887
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 15 deletions.
93 changes: 91 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"graphql": "16.8.1",
"react": "18.2.0",
"react-avatar": "5.0.3",
"react-code-blocks": "^0.1.5",
"react-dom": "18.2.0",
"react-icons": "4.12.0",
"react-markdown": "9.0.1",
Expand Down
20 changes: 7 additions & 13 deletions frontend/src/component/JavaCodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import SyntaxHighlighter from 'react-syntax-highlighter';
import { dracula } from 'react-syntax-highlighter/dist/esm/styles/hljs';
import { CodeBlock, atomOneDark } from 'react-code-blocks';
import React from 'react';
export default function javaCodeBlock(props: { code: string }) {
return (
<div>
<SyntaxHighlighter
language="java"
style={dracula}
sx={{ width: '300' }}
wrapLongLines
showInlineLineNumbers
>
{props.code}
</SyntaxHighlighter>
</div>
<CodeBlock
text={props.code}
language={'java'}
showLineNumbers={false}
theme={atomOneDark}
/>
);
}

0 comments on commit 57d5887

Please sign in to comment.