d02fc02ce1431c74a2aefdaf4137991d0552ba61
[arvados-workbench2.git] / src / views / process-log-panel / process-log-code-snippet.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { MuiThemeProvider, createMuiTheme, StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core/styles';
7 import { CodeSnippet } from '~/components/code-snippet/code-snippet';
8 import grey from '@material-ui/core/colors/grey';
9
10 type CssRules = 'codeSnippet';
11
12 const styles: StyleRulesCallback<CssRules> = () => ({
13     codeSnippet: {
14         maxHeight: '550px',
15     }
16 });
17
18 const theme = createMuiTheme({
19     overrides: {
20         MuiTypography: {
21             body1: {
22                 color: grey["200"]
23             },
24             root: {
25                 backgroundColor: '#000'
26             }
27         }
28     },
29     typography: {
30         fontFamily: 'monospace'
31     }
32 });
33
34 interface ProcessLogCodeSnippetProps {
35     lines: string[];
36 }
37
38 export const ProcessLogCodeSnippet = withStyles(styles)(
39     (props: ProcessLogCodeSnippetProps & WithStyles<CssRules>) =>
40         <MuiThemeProvider theme={theme}>
41             <CodeSnippet lines={props.lines} className={props.classes.codeSnippet} />
42         </MuiThemeProvider>);