X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/c90e813adcec89899d9db95843295a84fb058c3e..4bb9d50b428773c4712e8eebdb6756f45efb06f6:/src/components/breadcrumbs/breadcrumbs.tsx

diff --git a/src/components/breadcrumbs/breadcrumbs.tsx b/src/components/breadcrumbs/breadcrumbs.tsx
index 41f71981..444ac75e 100644
--- a/src/components/breadcrumbs/breadcrumbs.tsx
+++ b/src/components/breadcrumbs/breadcrumbs.tsx
@@ -11,59 +11,52 @@ export interface Breadcrumb {
     label: string;
 }
 
-interface BreadcrumbsProps {
+type CssRules = "item" | "currentItem" | "label";
+
+const styles: StyleRulesCallback<CssRules> = theme => ({
+    item: {
+        opacity: 0.6
+    },
+    currentItem: {
+        opacity: 1
+    },
+    label: {
+        textTransform: "none"
+    }
+});
+
+export interface BreadcrumbsProps {
     items: Breadcrumb[];
     onClick: (breadcrumb: Breadcrumb) => void;
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, breadcrumb: Breadcrumb) => void;
 }
 
-const Breadcrumbs: React.SFC<BreadcrumbsProps & WithStyles<CssRules>> = ({ classes, onClick, items }) => {
-    return <Grid container alignItems="center" wrap="nowrap">
-        {
-            items.map((item, index) => {
-                const isLastItem = index === items.length - 1;
-                return (
-                    <React.Fragment key={index}>
-                        <Tooltip title={item.label}>
-                            <Button
+export const Breadcrumbs = withStyles(styles)(
+    ({ classes, onClick, onContextMenu, items }: BreadcrumbsProps & WithStyles<CssRules>) =>
+    <Grid container alignItems="center" wrap="nowrap">
+    {
+        items.map((item, index) => {
+            const isLastItem = index === items.length - 1;
+            return (
+                <React.Fragment key={index}>
+                    <Tooltip title={item.label}>
+                        <Button
+                            color="inherit"
+                            className={isLastItem ? classes.currentItem : classes.item}
+                            onClick={() => onClick(item)}
+                            onContextMenu={event => onContextMenu(event, item)}>
+                            <Typography
+                                noWrap
                                 color="inherit"
-                                className={isLastItem ? classes.currentItem : classes.item}
-                                onClick={() => onClick(item)}
-                            >
-                                <Typography
-                                    noWrap
-                                    color="inherit"
-                                    className={classes.label}
-                                >
-                                    {item.label}
-                                </Typography>
-                            </Button>
-                        </Tooltip>
-                        {
-                            !isLastItem && <ChevronRightIcon color="inherit" className={classes.item} />
-                        }
-                    </React.Fragment>
-                );
-            })
-        }
-    </Grid>;
-};
-
-type CssRules = "item" | "currentItem" | "label";
-
-const styles: StyleRulesCallback<CssRules> = theme => {
-    const { unit } = theme.spacing;
-    return {
-        item: {
-            opacity: 0.6
-        },
-        currentItem: {
-            opacity: 1
-        },
-        label: {
-            textTransform: "none"
-        }
-    };
-};
-
-export default withStyles(styles)(Breadcrumbs);
-
+                                className={classes.label}>
+                                {item.label}
+                            </Typography>
+                        </Button>
+                    </Tooltip>
+                    {!isLastItem && <ChevronRightIcon color="inherit" className={classes.item} />}
+                </React.Fragment>
+            );
+        })
+    }
+    </Grid>
+);
