From: Artur Janicki Date: Tue, 3 Jul 2018 12:40:16 +0000 (+0200) Subject: #13704: change code after CR X-Git-Tag: 1.2.0~60^2~4 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/ef305b983cd28c2f3535cb6b3eb46e9a02e1a409 #13704: change code after CR Feature #13704 Arvados-DCO-1.1-Signed-off-by: Janicki Artur --- diff --git a/src/views-components/details-panel/details-panel.tsx b/src/views-components/details-panel/details-panel.tsx index ac4b151f..b63266a0 100644 --- a/src/views-components/details-panel/details-panel.tsx +++ b/src/views-components/details-panel/details-panel.tsx @@ -10,19 +10,11 @@ import { StyleRulesCallback, WithStyles, withStyles, Theme } from "@material-ui/ import Tabs from '@material-ui/core/Tabs'; import Tab from '@material-ui/core/Tab'; import Typography from '@material-ui/core/Typography'; -import * as classnames from "classnames"; import Grid from '@material-ui/core/Grid'; - -function TabContainer(props: any) { - return ( - - {props.children} - - ); -} +import * as classnames from "classnames"; export interface DetailsPanelProps { - toggleDrawer: (isOpened: boolean) => void; + closeDrawer: () => void; isOpened: boolean; } @@ -34,23 +26,27 @@ class DetailsPanel extends React.Component { this.setState({ tabsValue: value }); } - + + renderTabContainer = (children: React.ReactElement) => { + return ( + + {children} + + ); + } + render() { - const { classes, toggleDrawer, isOpened } = this.props; + const { classes, closeDrawer, isOpened } = this.props; const { tabsValue } = this.state; return (
- toggleDrawer(false)} - classes={{ - paper: classes.drawerPaper - }}> - {/* className={classnames([classes.root, { [classes.active]: isActive }])} */} + Tutorial pipeline - toggleDrawer(false)}> + @@ -66,7 +62,7 @@ class DetailsPanel extends React.Component - {tabsValue === 0 && + {tabsValue === 0 && this.renderTabContainer(

Type

@@ -81,8 +77,8 @@ class DetailsPanel extends React.Componentme

-
} - {tabsValue === 1 && + )} + {tabsValue === 1 && this.renderTabContainer(

Type

@@ -97,7 +93,7 @@ class DetailsPanel extends React.Componentme

-
} + )}
); @@ -109,7 +105,11 @@ type CssRules = 'drawerPaper' | 'container' | 'opened' | 'headerContainer' | 'tabsIndicator' | 'tabRoot' | 'tabContainer' | 'tabSelected' | 'gridLabel'; const drawerWidth = 320; -const purple = '#692498'; +const colorPurple = '#692498'; +const colorLightGray = '#A1A1A1'; +const colorVeryLightGray = '#999999'; +const colorGray = '#333'; + const styles: StyleRulesCallback = (theme: Theme) => ({ container: { width: 0, @@ -126,17 +126,17 @@ const styles: StyleRulesCallback = (theme: Theme) => ({ width: drawerWidth }, headerContainer: { - color: '#A1A1A1', + color: colorLightGray, margin: `${theme.spacing.unit}px 0` }, tabsIndicator: { - backgroundColor: purple + backgroundColor: colorPurple }, tabRoot: { - color: '#333333', + color: colorGray, '&$tabSelected': { fontWeight: 700, - color: purple + color: colorPurple } }, tabContainer: { @@ -144,7 +144,7 @@ const styles: StyleRulesCallback = (theme: Theme) => ({ }, tabSelected: {}, gridLabel: { - color: '#999999', + color: colorVeryLightGray, } }); 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 b03dccd9..135e1219 100644 --- a/src/views-components/main-app-bar/main-app-bar.tsx +++ b/src/views-components/main-app-bar/main-app-bar.tsx @@ -35,7 +35,7 @@ export interface MainAppBarActionProps { onSearch: (searchText: string) => void; onBreadcrumbClick: (breadcrumb: Breadcrumb) => void; onMenuItemClick: (menuItem: MainAppBarMenuItem) => void; - onDetailsPanelClick: (isOpened: boolean) => void; + onDetailsPanelToggle: () => void; } type MainAppBarProps = MainAppBarDataProps & MainAppBarActionProps & WithStyles; @@ -75,7 +75,7 @@ export const MainAppBar: React.SFC = (props) => { { props.user && } - props.onDetailsPanelClick(true)}> + diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index d8c24abe..2cca921c 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -144,8 +144,8 @@ class Workbench extends React.Component { this.props.dispatch(push(`/search?q=${searchText}`)); }, onMenuItemClick: (menuItem: NavMenuItem) => menuItem.action(), - onDetailsPanelClick: (isOpened: boolean) => { - this.setState({ isDetailsPanelOpened: isOpened }); + onDetailsPanelToggle: () => { + this.setState(prev => ({ isDetailsPanelOpened: !prev.isDetailsPanelOpened })); } }; @@ -204,7 +204,7 @@ class Workbench extends React.Component { + closeDrawer={this.mainAppBarActions.onDetailsPanelToggle} /> );