Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6430217

Browse files
committed
Add terminal output component
1 parent c65850b commit 6430217

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { makeStyles } from "@material-ui/core/styles"
2+
import React from "react"
3+
4+
interface Props {
5+
output: string[]
6+
}
7+
8+
export const TerminalOutput: React.FC<Props> = ({ className, output }) => {
9+
const styles = useStyles()
10+
11+
return (
12+
<div className={styles.root}>
13+
{output.map((line, idx) => (
14+
<div className={styles.line} key={idx}>
15+
{line}
16+
</div>
17+
))}
18+
</div>
19+
)
20+
}
21+
const MONOSPACE_FONT_FAMILY =
22+
"'Fira Code', 'Lucida Console', 'Lucida Sans Typewriter', 'Liberation Mono', 'Monaco', 'Courier New', Courier, monospace"
23+
24+
const useStyles = makeStyles((theme) => ({
25+
root: {
26+
minHeight: 156,
27+
background: theme.palette.background.default,
28+
//color: theme.palette.codeBlock.contrastText,
29+
fontFamily: MONOSPACE_FONT_FAMILY,
30+
fontSize: 13,
31+
wordBreak: "break-all",
32+
padding: theme.spacing(2),
33+
borderRadius: theme.shape.borderRadius,
34+
},
35+
line: {
36+
whiteSpace: "pre-wrap",
37+
},
38+
}))

0 commit comments

Comments
 (0)