aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Markdown/CodeBlock.tsx
blob: 743188118295f30433df2489c3aa26c192912164 (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
28
29
30
import React from 'react';
import { Paper, makeStyles } from '@material-ui/core';

interface PropTypes {
  value: string;
}

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

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

export default CodeBlock;