X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/91c6da4c4f84498a8473a0245a70c024ca9910d7..fd44760652570645bb40ff9445bb5b9305a7fa1c:/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 71e37f1f..23273dac 100644 --- a/src/components/file-tree/file-tree-item.tsx +++ b/src/components/file-tree/file-tree-item.tsx @@ -4,13 +4,13 @@ import * as React from "react"; import { TreeItem } from "../tree/tree"; -import { ProjectIcon, MoreOptionsIcon } from "../icon/icon"; -import { Typography, IconButton, StyleRulesCallback, withStyles, WithStyles } from "@material-ui/core"; -import { formatFileSize } from "../../common/formatters"; +import { ProjectIcon, MoreOptionsIcon, DefaultIcon, CollectionIcon } from "../icon/icon"; +import { Typography, IconButton, StyleRulesCallback, withStyles, WithStyles, Tooltip } from '@material-ui/core'; +import { formatFileSize } from "~/common/formatters"; import { ListItemTextIcon } from "../list-item-text-icon/list-item-text-icon"; import { FileTreeData } from "./file-tree-data"; -type CssRules = "root" | "spacer" | "sizeInfo" | "button"; +type CssRules = "root" | "spacer" | "sizeInfo" | "button" | "moreOptions"; const fileTreeItemStyle: StyleRulesCallback = theme => ({ root: { @@ -22,11 +22,15 @@ const fileTreeItemStyle: StyleRulesCallback = theme => ({ flex: "1" }, sizeInfo: { - marginRight: `${theme.spacing.unit * 3}px` + width: `${theme.spacing.unit * 8}px` }, button: { width: theme.spacing.unit * 3, - height: theme.spacing.unit * 3 + height: theme.spacing.unit * 3, + marginRight: theme.spacing.unit, + }, + moreOptions: { + position: 'absolute' } }); @@ -38,20 +42,25 @@ export const FileTreeItem = withStyles(fileTreeItemStyle)( class extends React.Component> { render() { const { classes, item } = this.props; - return
- -
- {formatFileSize(item.data.size)} - - - -
; + return <> +
+ +
+ {formatFileSize(item.data.size)} + + + + + +
+ ; } handleClick = (event: React.MouseEvent) => { @@ -59,3 +68,14 @@ export const FileTreeItem = withStyles(fileTreeItemStyle)( } }); +export const getIcon = (type: string) => { + switch (type) { + case 'directory': + return ProjectIcon; + case 'file': + return CollectionIcon; + default: + return DefaultIcon; + } +}; +