From e3f871044c39ae05d5c84b5157a1f12579811303 Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Thu, 14 May 2020 23:23:12 -0700 Subject: working code render --- frontend/src/components/renderers/Code.js | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 frontend/src/components/renderers/Code.js (limited to 'frontend/src/components/renderers/Code.js') diff --git a/frontend/src/components/renderers/Code.js b/frontend/src/components/renderers/Code.js new file mode 100644 index 0000000..7139aee --- /dev/null +++ b/frontend/src/components/renderers/Code.js @@ -0,0 +1,56 @@ +import React from 'react'; +import styled from 'styled-components' +import { Light as SyntaxHighlighter } from 'react-syntax-highlighter'; +import { atomOneLight, ascetic, atomOneDark, dracula, ocean } from 'react-syntax-highlighter/dist/esm/styles/hljs'; + +export const THEMES = Object.freeze({ + 'atom': atomOneLight, + 'atom dark': atomOneDark, + 'plain': ascetic, + 'dracula': dracula, + 'ocean': ocean, +}) + +export const LANGS = Object.freeze({ + 'go': 'go', + 'python': 'python', + 'javscript': 'javascript', + 'html': 'html', + 'css': 'css', + 'c': 'c', + 'c++': 'cpp', + 'c#': 'cs', + 'ruby': 'ruby', + 'docker': 'dockerfile', + 'bash': 'bash', + 'raw': 'text', + 'java': 'java', + 'lisp': 'lisp', + 'haskell': 'haskell', + 'scala': 'scala', + 'markdown': 'markdown', + 'makefile': 'makefile', + 'php': 'php', + 'latex': 'latex', + 'yaml': 'yaml' +}) + +const RelPositioning = styled.div` + position: relative; +` + +const CodeRenderer = (props) => { + return ( + + + {props.content} + + + ); +}; + +export default CodeRenderer \ No newline at end of file -- cgit v1.2.3 From 4b8a17b2d45ab386791412b608211bca765ba38b Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Thu, 14 May 2020 23:32:28 -0700 Subject: fix typo --- frontend/src/components/renderers/Code.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'frontend/src/components/renderers/Code.js') diff --git a/frontend/src/components/renderers/Code.js b/frontend/src/components/renderers/Code.js index 7139aee..12efc67 100644 --- a/frontend/src/components/renderers/Code.js +++ b/frontend/src/components/renderers/Code.js @@ -14,7 +14,7 @@ export const THEMES = Object.freeze({ export const LANGS = Object.freeze({ 'go': 'go', 'python': 'python', - 'javscript': 'javascript', + 'javascript': 'javascript', 'html': 'html', 'css': 'css', 'c': 'c', -- cgit v1.2.3