[ARVADOS-WORKBENCH2] updated: ce55180216574bddb30dd052215a7320632a9fb1
Git user
git at public.curoverse.com
Fri Jun 8 03:50:44 EDT 2018
Summary of changes:
src/components/tree/tree.tsx | 38 +++++++++++++++++++++++++-------------
src/views/workbench/workbench.tsx | 1 +
2 files changed, 26 insertions(+), 13 deletions(-)
via ce55180216574bddb30dd052215a7320632a9fb1 (commit)
from 73da4aae95f9186c71533e3c26cecce23f52fc02 (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 ce55180216574bddb30dd052215a7320632a9fb1
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Fri Jun 8 09:50:25 2018 +0200
Generic tree issue withStyles
Feature #13535
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx
index 0be5499..a8cfabd 100644
--- a/src/components/tree/tree.tsx
+++ b/src/components/tree/tree.tsx
@@ -5,9 +5,19 @@
import * as React from 'react';
import List from "@material-ui/core/List/List";
import ListItem from "@material-ui/core/ListItem/ListItem";
+import { StyleRulesCallback, Theme, withStyles, WithStyles } from '@material-ui/core/styles';
import { ReactElement } from "react";
import Collapse from "@material-ui/core/Collapse/Collapse";
+type CssRules = 'list';
+
+const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
+ list: {
+ paddingBottom: '3px',
+ paddingTop: '3px',
+ }
+});
+
export interface TreeItem<T> {
data: T;
id: string;
@@ -23,25 +33,26 @@ interface TreeProps<T> {
level?: number;
}
-function colorArrows(open: boolean, color: string){
- return <i style={{marginRight: '10px', minWidth: '10px', color}} className={open ? "fas fa-caret-down" : "fas fa-caret-right"} />
-}
-
-class Tree<T> extends React.Component<TreeProps<T>, {}> {
+class Tree<T> extends React.Component<TreeProps<T> & WithStyles<CssRules>, {}> {
render(): ReactElement<any> {
const level = this.props.level ? this.props.level : 0;
- return <List component="div" style={{paddingBottom: '3px', paddingTop: '3px'}}>
- {this.props.items && this.props.items.map((it: TreeItem<T>, idx: number) =>
+ const {classes, render, toggleItem, items} = this.props;
+ return <List component="div" className={classes.list}>
+ {items && items.map((it: TreeItem<T>, idx: number) =>
<div key={`item/${level}/${idx}`}>
- <ListItem button onClick={() => this.props.toggleItem(it.id)} style={{paddingLeft: (level + 1) * 15, paddingBottom: '3px', paddingTop: '3px'}}>
- {it.active ? colorArrows(it.open, "#4285F6") : colorArrows(it.open, "#333")}
- {this.props.render(it)}
+ <ListItem button onClick={() => toggleItem(it.id)} className={classes.list} style={{paddingLeft: (level + 1) * 15}}>
+ {
+ it.active ?
+ (it.items && it.items.length > 0 ? <i style={{color: '#4285F6', position: 'absolute'}} className={it.open ? "fas fa-caret-down" : "fas fa-caret-right"} /> : null) :
+ (it.items && it.items.length > 0 ? <i style={{position: 'absolute'}} className={it.open ? "fas fa-caret-down" : "fas fa-caret-right"} /> : null)
+ }
+ {render(it)}
</ListItem>
{it.items && it.items.length > 0 &&
<Collapse in={it.open} timeout="auto" unmountOnExit>
<Tree items={it.items}
- render={this.props.render}
- toggleItem={this.props.toggleItem}
+ render={render}
+ toggleItem={toggleItem}
level={level + 1}/>
</Collapse>}
</div>)}
@@ -49,4 +60,5 @@ class Tree<T> extends React.Component<TreeProps<T>, {}> {
}
}
-export default Tree;
+
+export default withStyles(styles)(Tree);
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 5643602..58f2fcf 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -55,6 +55,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
row: {
display: 'flex',
alignItems: 'center',
+ marginLeft: '20px',
},
treeContainer: {
position: 'absolute',
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list