aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Markdown/CodeBlock.tsx
blob: c4478ebb3a38c387f9805956a5983c3d2138d9b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import React from 'react';
import { ParserPropTypes } from './types';
import { Paper } from '@material-ui/core';

import { makeStyles } from '@material-ui/core/styles';

const useStyles = makeStyles(theme => ({
  root: {
    background: theme.palette.background.default,
    padding: theme.spacing(2),
    overflowX: 'auto',
    fontFamily: 'Monospace',
  },
}));

const CodeBlock: React.FC<ParserPropTypes> = ({ rawLines }) => {
  const classes = useStyles();
  return (
    <Paper variant="outlined" className={classes.root}>
      {rawLines.map(line => <> {line} <br/> </>)}
    </Paper>
  );
}

export default CodeBlock;