X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/c4621fbe523cc60770f4176141b83083f1f3802a..829d595bb4b9e7c0a8a1dd38995b4b5e197841f5:/src/components/code-snippet/code-snippet.tsx?ds=sidebyside

diff --git a/src/components/code-snippet/code-snippet.tsx b/src/components/code-snippet/code-snippet.tsx
index b622210f..f156e3e8 100644
--- a/src/components/code-snippet/code-snippet.tsx
+++ b/src/components/code-snippet/code-snippet.tsx
@@ -2,36 +2,39 @@
 //
 // 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 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<CssRules> = (theme: ArvadosTheme) => ({
     root: {
         boxSizing: 'border-box',
-        width: '100%',
-        height: 'auto',
-        maxHeight: '550px',
-        overflow: 'scroll',
+        overflow: 'auto',
         padding: theme.spacing.unit
+    },
+    space: {
+        marginLeft: '15px'
     }
 });
 
 export interface CodeSnippetDataProps {
     lines: string[];
+    className?: string;
+    apiResponse?: boolean;
 }
 
 type CodeSnippetProps = CodeSnippetDataProps & WithStyles<CssRules>;
 
 export const CodeSnippet = withStyles(styles)(
-    ({ classes, lines }: CodeSnippetProps) =>
-        <Typography component="div" className={classes.root}>
-            {
-                lines.map((line: string, index: number) => {
-                    return <Typography key={index} component="pre">{line}</Typography>;
-                })
-            }
+    ({ classes, lines, className, apiResponse }: CodeSnippetProps) =>
+        <Typography
+        component="div"
+        className={classNames(classes.root, className)}>
+            <Typography className={apiResponse ? classes.space : className} component="pre">
+                {lines.join('\n')}
+            </Typography>
         </Typography>
-    );
\ No newline at end of file
+    );
