diff options
| author | jackyzha0 <[email protected]> | 2020-05-22 20:27:45 -0700 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2020-05-22 20:27:45 -0700 |
| commit | 5ea295f857952d80d2423be78618e5e3841fdec7 (patch) | |
| tree | f50aaebd9d3af23a067e5085f8f3aa2272441ecd /frontend/src/components/renderers/Code.js | |
| parent | Merge pull request #29 from jackyzha0/order-langs (diff) | |
| download | ctrl-v-5ea295f857952d80d2423be78618e5e3841fdec7.tar.xz ctrl-v-5ea295f857952d80d2423be78618e5e3841fdec7.zip | |
styling fixes
Diffstat (limited to 'frontend/src/components/renderers/Code.js')
| -rw-r--r-- | frontend/src/components/renderers/Code.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/frontend/src/components/renderers/Code.js b/frontend/src/components/renderers/Code.js index 02c1cc6..0c601b3 100644 --- a/frontend/src/components/renderers/Code.js +++ b/frontend/src/components/renderers/Code.js @@ -1,6 +1,7 @@ import React from 'react'; import { Light as SyntaxHighlighter } from 'react-syntax-highlighter'; import { atomOneLight, ascetic, atomOneDark, dracula, ocean } from 'react-syntax-highlighter/dist/esm/styles/hljs'; +import styled from 'styled-components' export const THEMES = Object.freeze({ 'atom': atomOneLight, @@ -34,16 +35,31 @@ export const LANGS = Object.freeze({ 'yaml': 'yaml' }) +const StyledPre = styled.pre` + padding: 0 !important; + margin: 0; +` + +const CodeBlock = styled.div` + width: 100%; + font-size: 0.8em; + padding: calc(0.8em - 1px) !important; + border-radius: 3px; + border: 1px solid #565656; + outline: none; + margin: 1.7em 0; +` + const CodeRenderer = React.forwardRef((props, ref) => { const Pre = (props) => { return ( - <pre {...props} ref={ref} /> + <StyledPre {...props} ref={ref} /> ); } return ( - <div className="lt-shadow codeBlock"> + <CodeBlock className="lt-shadow"> <SyntaxHighlighter ref={ref} language={props.lang} @@ -52,7 +68,7 @@ const CodeRenderer = React.forwardRef((props, ref) => { PreTag={Pre}> {props.content} </SyntaxHighlighter> - </div> + </CodeBlock> ); }); |