[ARVADOS-WORKBENCH2] updated: 1.1.4-178-g5844264

Git user git at public.curoverse.com
Fri Jul 6 02:50:10 EDT 2018


Summary of changes:
 src/common/custom-theme.ts                         | 61 ++++++++++++++++++++++
 src/index.tsx                                      | 20 ++++---
 .../details-panel/details-panel.tsx                | 56 ++++++--------------
 src/views-components/main-app-bar/main-app-bar.tsx | 26 +++------
 src/views/workbench/workbench.tsx                  | 12 ++---
 5 files changed, 101 insertions(+), 74 deletions(-)
 create mode 100644 src/common/custom-theme.ts

       via  5844264e8def16755e8da6e7e57a716e69a130ff (commit)
      from  ef305b983cd28c2f3535cb6b3eb46e9a02e1a409 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 5844264e8def16755e8da6e7e57a716e69a130ff
Author: Artur Janicki <artur.janicki at contractors.roche.com>
Date:   Tue Jul 3 14:40:16 2018 +0200

    #13704: add custom theme and clean code
    
    Feature #13704
    
    Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki at contractors.roche.com>

diff --git a/src/common/custom-theme.ts b/src/common/custom-theme.ts
new file mode 100644
index 0000000..e78185d
--- /dev/null
+++ b/src/common/custom-theme.ts
@@ -0,0 +1,61 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { createMuiTheme } from '@material-ui/core/styles';
+import { ThemeOptions, Theme } from '@material-ui/core/styles/createMuiTheme';
+import purple from '@material-ui/core/colors/purple';
+import blue from '@material-ui/core/colors/blue';
+import grey from '@material-ui/core/colors/grey';
+
+interface ArvadosThemeOptions extends ThemeOptions {
+    customs: any;
+}
+
+export interface ArvadosTheme extends Theme {
+    customs: any;
+}
+
+const purple900 = purple["900"];
+const grey600 = grey["600"];
+const themeOptions: ArvadosThemeOptions = {
+    customs: {
+        colors: {
+            
+        }
+    },
+    overrides: {
+        MuiAppBar: {
+            colorPrimary: {
+                backgroundColor: purple900
+            }
+        },
+        MuiTabs: {
+            root: {
+                color: grey600
+            },
+            indicator: {
+                backgroundColor: purple900
+            }
+        },
+        MuiTab: {
+            selected: {
+                fontWeight: 700,
+                color: purple900
+            }
+        }
+    },
+    mixins: {
+        toolbar: {
+            minHeight: '48px'
+        }
+    },
+    palette: {
+        primary: {
+            main: '#06C',
+            dark: blue.A100
+        }
+    }
+};
+
+export const CustomTheme = createMuiTheme(themeOptions);
\ No newline at end of file
diff --git a/src/index.tsx b/src/index.tsx
index 5804878..21ecdab 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -15,6 +15,8 @@ import ApiToken from "./views-components/api-token/api-token";
 import authActions from "./store/auth/auth-action";
 import { authService } from "./services/services";
 import { getProjectList } from "./store/project/project-action";
+import { MuiThemeProvider } from '@material-ui/core/styles';
+import { CustomTheme } from './common/custom-theme';
 
 const history = createBrowserHistory();
 
@@ -25,14 +27,16 @@ const rootUuid = authService.getRootUuid();
 store.dispatch<any>(getProjectList(rootUuid));
 
 const App = () =>
-    <Provider store={store}>
-        <ConnectedRouter history={history}>
-            <div>
-                <Route path="/" component={Workbench}/>
-                <Route path="/token" component={ApiToken}/>
-            </div>
-        </ConnectedRouter>
-    </Provider>;
+    <MuiThemeProvider theme={CustomTheme}>
+        <Provider store={store}>
+            <ConnectedRouter history={history}>
+                <div>
+                    <Route path="/" component={Workbench}/>
+                    <Route path="/token" component={ApiToken}/>
+                </div>
+            </ConnectedRouter>
+        </Provider>
+    </MuiThemeProvider>;
 
 ReactDOM.render(
     <App/>,
diff --git a/src/views-components/details-panel/details-panel.tsx b/src/views-components/details-panel/details-panel.tsx
index b63266a..a864d50 100644
--- a/src/views-components/details-panel/details-panel.tsx
+++ b/src/views-components/details-panel/details-panel.tsx
@@ -6,7 +6,8 @@ import * as React from 'react';
 import Drawer from '@material-ui/core/Drawer';
 import IconButton from "@material-ui/core/IconButton";
 import CloseIcon from '@material-ui/icons/Close';
-import { StyleRulesCallback, WithStyles, withStyles, Theme } from "@material-ui/core/styles";
+import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
+import { ArvadosTheme } from '../../common/custom-theme';
 import Tabs from '@material-ui/core/Tabs';
 import Tab from '@material-ui/core/Tab';
 import Typography from '@material-ui/core/Typography';
@@ -14,7 +15,7 @@ import Grid from '@material-ui/core/Grid';
 import * as classnames from "classnames";
 
 export interface DetailsPanelProps {
-    closeDrawer: () => void;
+    onCloseDrawer: () => void;
     isOpened: boolean;
 }
 
@@ -27,16 +28,13 @@ class DetailsPanel extends React.Component<DetailsPanelProps & WithStyles<CssRul
 		this.setState({ tabsValue: value });
 	}
     
-    renderTabContainer = (children: React.ReactElement<any>) => {
-        return (
-            <Typography className={this.props.classes.tabContainer} component="div">
-                {children}
-            </Typography>
-        );
-    }
+    renderTabContainer = (children: React.ReactElement<any>) => 
+        <Typography className={this.props.classes.tabContainer} component="div">
+            {children}
+        </Typography>
 
 	render() {
-        const { classes, closeDrawer, isOpened } = this.props;
+        const { classes, onCloseDrawer, isOpened } = this.props;
 		const { tabsValue } = this.state;
         return (
             <div className={classnames([classes.container, { [classes.opened]: isOpened }])}>
@@ -46,21 +44,14 @@ class DetailsPanel extends React.Component<DetailsPanelProps & WithStyles<CssRul
 							<Typography variant="title">
 								Tutorial pipeline
 							</Typography>
-                            <IconButton color="inherit" onClick={closeDrawer}>
+                            <IconButton color="inherit" onClick={onCloseDrawer}>
 								<CloseIcon />
 							</IconButton>
 						</Grid>
 					</Typography>
-					<Tabs value={tabsValue} onChange={this.handleChange}
-						classes={{ indicator: classes.tabsIndicator }}>
-						<Tab
-							disableRipple
-							classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
-							label="Details" />
-						<Tab
-							disableRipple
-							classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
-							label="Activity" />
+					<Tabs value={tabsValue} onChange={this.handleChange}>
+						<Tab disableRipple label="Details" />
+						<Tab disableRipple label="Activity" />
 					</Tabs>
                     {tabsValue === 0 && this.renderTabContainer(
 						<Grid container>
@@ -102,15 +93,10 @@ class DetailsPanel extends React.Component<DetailsPanelProps & WithStyles<CssRul
 }
 
 type CssRules = 'drawerPaper' | 'container' | 'opened' | 'headerContainer' 
-	| 'tabsIndicator' | 'tabRoot' | 'tabContainer' | 'tabSelected' | 'gridLabel';
+	| 'tabContainer' | 'tabSelected' | 'gridLabel';
 
 const drawerWidth = 320;
-const colorPurple = '#692498';
-const colorLightGray = '#A1A1A1';
-const colorVeryLightGray = '#999999';
-const colorGray = '#333';
-
-const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
 	container: {
         width: 0,
 		position: 'relative',
@@ -126,25 +112,15 @@ const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
         width: drawerWidth
 	},
 	headerContainer: {
-        color: colorLightGray,
+        color: theme.palette.grey["600"],
 		margin: `${theme.spacing.unit}px 0`
 	},
-	tabsIndicator: {
-        backgroundColor: colorPurple
-	},
-	tabRoot: {
-        color: colorGray,
-		'&$tabSelected': {
-			fontWeight: 700,
-            color: colorPurple
-		}
-	},
 	tabContainer: {
 		padding: theme.spacing.unit * 3
 	},
 	tabSelected: {},
 	gridLabel: {
-        color: colorVeryLightGray,
+        color: theme.palette.grey["500"]
 	}
 });
 
diff --git a/src/views-components/main-app-bar/main-app-bar.tsx b/src/views-components/main-app-bar/main-app-bar.tsx
index 135e121..1230e3b 100644
--- a/src/views-components/main-app-bar/main-app-bar.tsx
+++ b/src/views-components/main-app-bar/main-app-bar.tsx
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { AppBar, Toolbar, Typography, Grid, IconButton, Badge, StyleRulesCallback, withStyles, WithStyles, Button, MenuItem } from "@material-ui/core";
+import { AppBar, Toolbar, Typography, Grid, IconButton, Badge, Button, MenuItem } from "@material-ui/core";
 import NotificationsIcon from "@material-ui/icons/Notifications";
 import PersonIcon from "@material-ui/icons/Person";
 import HelpIcon from "@material-ui/icons/Help";
@@ -38,15 +38,12 @@ export interface MainAppBarActionProps {
     onDetailsPanelToggle: () => void;
 }
 
-type MainAppBarProps = MainAppBarDataProps & MainAppBarActionProps & WithStyles<CssRules>;
+type MainAppBarProps = MainAppBarDataProps & MainAppBarActionProps;
 
 export const MainAppBar: React.SFC<MainAppBarProps> = (props) => {
-    return <AppBar className={props.classes.appBar} position="static">
-        <Toolbar className={props.classes.toolbar}>
-            <Grid
-                container
-                justify="space-between"
-            >
+    return <AppBar position="static">
+        <Toolbar>
+            <Grid container justify="space-between">
                 <Grid item xs={3}>
                     <Typography variant="headline" color="inherit" noWrap>
                         Arvados
@@ -120,15 +117,4 @@ const renderMenuItems = (menuItems: MainAppBarMenuItem[], onMenuItemClick: (menu
     ));
 };
 
-type CssRules = "appBar" | "toolbar";
-
-const styles: StyleRulesCallback<CssRules> = theme => ({
-    appBar: {
-        backgroundColor: "#692498"
-    },
-    toolbar: {
-        minHeight: '48px'
-    }
-});
-
-export default withStyles(styles)(MainAppBar);
+export default MainAppBar;
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 2cca921..8cc5fc2 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { StyleRulesCallback, Theme, WithStyles, withStyles } from '@material-ui/core/styles';
+import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
 import Drawer from '@material-ui/core/Drawer';
 import { connect, DispatchProp } from "react-redux";
 import { Route, Switch, RouteComponentProps, withRouter } from "react-router";
@@ -29,13 +29,14 @@ import projectActions from "../../store/project/project-action";
 import ProjectPanel from "../project-panel/project-panel";
 import { sidePanelData } from '../../store/side-panel/side-panel-reducer';
 import DetailsPanel from '../../views-components/details-panel/details-panel';
+import { ArvadosTheme } from '../../common/custom-theme';
 
 const drawerWidth = 240;
-const appBarHeight = 116;
+const appBarHeight = 100;
 
 type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'contentWrapper' | 'toolbar';
 
-const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     root: {
         flexGrow: 1,
         zIndex: 1,
@@ -47,7 +48,6 @@ const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
     },
     appBar: {
         zIndex: theme.zIndex.drawer + 1,
-        backgroundColor: '#692498',
         position: "absolute",
         width: "100%"
     },
@@ -65,7 +65,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
         paddingTop: appBarHeight
     },
     content: {
-        padding: theme.spacing.unit * 3,
+        padding: `${theme.spacing.unit}px ${theme.spacing.unit * 3}px`,
         overflowY: "auto",
         flexGrow: 1
     },
@@ -204,7 +204,7 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
                     </div>
                     <DetailsPanel 
                         isOpened={this.state.isDetailsPanelOpened} 
-                        closeDrawer={this.mainAppBarActions.onDetailsPanelToggle} />
+                        onCloseDrawer={this.mainAppBarActions.onDetailsPanelToggle} />
                 </main>
             </div>
         );

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list