[ARVADOS-WORKBENCH2] created: 1.2.0-223-g7ea39b3

Git user git at public.curoverse.com
Fri Aug 31 08:37:52 EDT 2018


        at  7ea39b36221b18b0243f10901c43e5fc8d41d88f (commit)


commit 7ea39b36221b18b0243f10901c43e5fc8d41d88f
Author: Janicki Artur <artur.janicki at contractors.roche.com>
Date:   Fri Aug 31 14:37:35 2018 +0200

    add code snippet component and default code snippet
    
    Feature #14138
    
    Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki at contractors.roche.com>

diff --git a/src/components/code-snippet/code-snippet.tsx b/src/components/code-snippet/code-snippet.tsx
new file mode 100644
index 0000000..bf9b612
--- /dev/null
+++ b/src/components/code-snippet/code-snippet.tsx
@@ -0,0 +1,36 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// 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';
+
+type CssRules = 'root';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+        boxSizing: 'border-box',
+        width: '100%',
+        height: '550px',
+        overflow: 'scroll',
+        padding: theme.spacing.unit
+    }
+});
+
+export interface CodeSnippetDataProps {
+    lines: string[];
+}
+
+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="div">{line}</Typography>;
+                })
+            }
+        </Typography>
+    );
\ No newline at end of file
diff --git a/src/components/default-code-snippet/default-code-snippet.tsx b/src/components/default-code-snippet/default-code-snippet.tsx
new file mode 100644
index 0000000..474c38a
--- /dev/null
+++ b/src/components/default-code-snippet/default-code-snippet.tsx
@@ -0,0 +1,31 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
+import { CodeSnippet, CodeSnippetDataProps } from '~/components/code-snippet/code-snippet';
+import grey from '@material-ui/core/colors/grey';
+
+const theme = createMuiTheme({
+    overrides: {
+        MuiTypography: {
+            body1: {
+                color: grey["200"]
+            },
+            root: {
+                backgroundColor: '#000'
+            }
+        }
+    },
+    typography: {
+        fontFamily: 'VT323'
+    }
+});
+
+type DefaultCodeSnippet = CodeSnippetDataProps;
+
+export const DefaultCodeSnippet = (props: DefaultCodeSnippet) => 
+    <MuiThemeProvider theme={theme}>
+        <CodeSnippet lines={props.lines} />
+    </MuiThemeProvider>;
\ No newline at end of file

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list