From 7ea39b36221b18b0243f10901c43e5fc8d41d88f Mon Sep 17 00:00:00 2001 From: Janicki Artur Date: Fri, 31 Aug 2018 14:37:35 +0200 Subject: [PATCH] add code snippet component and default code snippet Feature #14138 Arvados-DCO-1.1-Signed-off-by: Janicki Artur --- src/components/code-snippet/code-snippet.tsx | 36 +++++++++++++++++++ .../default-code-snippet.tsx | 31 ++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 src/components/code-snippet/code-snippet.tsx create mode 100644 src/components/default-code-snippet/default-code-snippet.tsx diff --git a/src/components/code-snippet/code-snippet.tsx b/src/components/code-snippet/code-snippet.tsx new file mode 100644 index 00000000..bf9b6128 --- /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 = (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; + +export const CodeSnippet = withStyles(styles)( + ({ classes, lines }: CodeSnippetProps) => + + { + lines.map((line: string, index: number) => { + return {line}; + }) + } + + ); \ 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 00000000..474c38a1 --- /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) => + + + ; \ No newline at end of file -- 2.30.2