aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Markdown/CodeBlock.tsx
blob: 394458e68b87118b93b211eac586910bfb802f83 (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
27
import React from 'react';
import { Paper } from '@material-ui/core';

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

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

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

export default CodeBlock;