projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add typescript paths to top level folders
[arvados-workbench2.git]
/
src
/
components
/
file-tree
/
file-tree-item.tsx
diff --git
a/src/components/file-tree/file-tree-item.tsx
b/src/components/file-tree/file-tree-item.tsx
index 71e37f1f570cc0afc4341ea66af5efd801179bab..e2d6b26cb4117e913c396e5cb105bbb8dbc7a3e8 100644
(file)
--- a/
src/components/file-tree/file-tree-item.tsx
+++ b/
src/components/file-tree/file-tree-item.tsx
@@
-4,9
+4,9
@@
import * as React from "react";
import { TreeItem } from "../tree/tree";
import * as React from "react";
import { TreeItem } from "../tree/tree";
-import { ProjectIcon, MoreOptionsIcon } from "../icon/icon";
+import { ProjectIcon, MoreOptionsIcon
, DefaultIcon, CollectionIcon
} from "../icon/icon";
import { Typography, IconButton, StyleRulesCallback, withStyles, WithStyles } from "@material-ui/core";
import { Typography, IconButton, StyleRulesCallback, withStyles, WithStyles } from "@material-ui/core";
-import { formatFileSize } from "
../..
/common/formatters";
+import { formatFileSize } from "
~
/common/formatters";
import { ListItemTextIcon } from "../list-item-text-icon/list-item-text-icon";
import { FileTreeData } from "./file-tree-data";
import { ListItemTextIcon } from "../list-item-text-icon/list-item-text-icon";
import { FileTreeData } from "./file-tree-data";
@@
-22,11
+22,12
@@
const fileTreeItemStyle: StyleRulesCallback<CssRules> = theme => ({
flex: "1"
},
sizeInfo: {
flex: "1"
},
sizeInfo: {
-
marginRight: `${theme.spacing.unit * 3
}px`
+
width: `${theme.spacing.unit * 8
}px`
},
button: {
width: theme.spacing.unit * 3,
},
button: {
width: theme.spacing.unit * 3,
- height: theme.spacing.unit * 3
+ height: theme.spacing.unit * 3,
+ marginRight: theme.spacing.unit
}
});
}
});
@@
-40,7
+41,7
@@
export const FileTreeItem = withStyles(fileTreeItemStyle)(
const { classes, item } = this.props;
return <div className={classes.root}>
<ListItemTextIcon
const { classes, item } = this.props;
return <div className={classes.root}>
<ListItemTextIcon
- icon={
ProjectIcon
}
+ icon={
getIcon(item)
}
name={item.data.name} />
<div className={classes.spacer} />
<Typography
name={item.data.name} />
<div className={classes.spacer} />
<Typography
@@
-59,3
+60,14
@@
export const FileTreeItem = withStyles(fileTreeItemStyle)(
}
});
}
});
+const getIcon = (item: TreeItem<FileTreeData>) => {
+ switch(item.data.type){
+ case 'directory':
+ return ProjectIcon;
+ case 'file':
+ return CollectionIcon;
+ default:
+ return DefaultIcon;
+ }
+};
+