1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import 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 import { ArvadosTheme } from 'common/custom-theme';
11 type CssRules = 'wordWrap' | 'codeSnippetContainer';
13 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
15 whiteSpace: 'pre-wrap',
17 codeSnippetContainer: {
18 height: `calc(100% - ${theme.spacing.unit * 4}px)`, // so that horizontal scollbar is visible
22 const theme = createMuiTheme({
29 backgroundColor: '#000'
34 fontFamily: 'monospace',
35 useNextVariants: true,
39 interface ProcessLogCodeSnippetProps {
45 export const ProcessLogCodeSnippet = withStyles(styles)(
46 (props: ProcessLogCodeSnippetProps & WithStyles<CssRules>) =>
47 <MuiThemeProvider theme={theme}>
48 <CodeSnippet lines={props.lines} fontSize={props.fontSize}
49 className={props.wordWrap ? props.classes.wordWrap : undefined}
50 containerClassName={props.classes.codeSnippetContainer} />