X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/c324b64f3b26e79b4640b6f0cf55671f1a261bca..6ddc4f58120358fa12de736c49be69f8373b4068:/src/components/code-snippet/code-snippet.tsx diff --git a/src/components/code-snippet/code-snippet.tsx b/src/components/code-snippet/code-snippet.tsx index 6cba299f..fd44b5fc 100644 --- a/src/components/code-snippet/code-snippet.tsx +++ b/src/components/code-snippet/code-snippet.tsx @@ -2,37 +2,46 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; -import { StyleRulesCallback, WithStyles, Typography, withStyles, Theme } from '@material-ui/core'; -import { ArvadosTheme } from '~/common/custom-theme'; -import * as classNames from 'classnames'; +import React from 'react'; +import { StyleRulesCallback, WithStyles, Typography, withStyles } from '@material-ui/core'; +import { ArvadosTheme } from 'common/custom-theme'; +import classNames from 'classnames'; -type CssRules = 'root'; +type CssRules = 'root' | 'space'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { boxSizing: 'border-box', overflow: 'auto', padding: theme.spacing.unit + }, + space: { + marginLeft: '15px' } }); export interface CodeSnippetDataProps { lines: string[]; className?: string; + apiResponse?: boolean; + containerClassName?: string; + fontSize?: number; + customRenderer?: (line: string) => React.ReactNode; } type CodeSnippetProps = CodeSnippetDataProps & WithStyles; export const CodeSnippet = withStyles(styles)( - ({ classes, lines, className }: CodeSnippetProps) => - - { - lines.map((line: string, index: number) => { - return {line}; - }) - } + ({ classes, lines, className, containerClassName, + apiResponse, fontSize, customRenderer }: CodeSnippetProps) => + + { lines.map((line: string, index: number) => { + return + {customRenderer ? customRenderer(line) : line} + ; + }) } ); \ No newline at end of file