[ARVADOS-WORKBENCH2] updated: 1.1.4-56-gd9846c5

Git user git at public.curoverse.com
Thu Jun 14 03:49:12 EDT 2018


Summary of changes:
 src/components/breadcrumbs/breadcrumbs.tsx | 60 ++++++++++++------------------
 1 file changed, 24 insertions(+), 36 deletions(-)

       via  d9846c586fe756b07f9b0c4898a99990653058de (commit)
      from  a884c545e3edad2cc2ac1210fc3148f922c155dc (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 d9846c586fe756b07f9b0c4898a99990653058de
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Thu Jun 14 09:48:55 2018 +0200

    Refactor breadcrumbs component
    
    Feature #13590
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/components/breadcrumbs/breadcrumbs.tsx b/src/components/breadcrumbs/breadcrumbs.tsx
index 33ff33a..25f30a1 100644
--- a/src/components/breadcrumbs/breadcrumbs.tsx
+++ b/src/components/breadcrumbs/breadcrumbs.tsx
@@ -13,55 +13,43 @@ export interface Breadcrumb {
 
 interface BreadcrumbsProps {
     items: Breadcrumb[];
-    onClick: (breadcrumb: Breadcrumb) => any;
+    onClick: (breadcrumb: Breadcrumb) => void;
 }
 
-const Breadcrumbs: React.SFC<BreadcrumbsProps & WithStyles<CssRules>> = (props) => {
-    const { classes, onClick, items } = props;
+const Breadcrumbs: React.SFC<BreadcrumbsProps & WithStyles<CssRules>> = ({ classes, onClick, items }) => {
     return <Grid container alignItems="center">
         {
-            getInactiveItems(items).map((item, index) => (
-                <React.Fragment key={index}>
-                    <Button
-                        color="inherit"
-                        className={classes.inactiveItem}
-                        onClick={() => onClick(item)}
-                    >
-                        {item.label}
-                    </Button>
-                    <ChevronRightIcon color="inherit" className={classes.inactiveItem} />
-                </React.Fragment>
-            ))
-        }
-        {
-            getActiveItem(items).map((item, index) => (
-                <Button
-                    color="inherit"
-                    key={index}
-                    onClick={() => onClick(item)}
-                >
-                    {item.label}
-                </Button>
-            ))
+            items.map((item, index) => {
+                const isLastItem = index === items.length - 1;
+                return (
+                    <React.Fragment key={index}>
+                        <Button
+                            color="inherit"
+                            className={isLastItem ? classes.currentItem : classes.item}
+                            onClick={() => onClick(item)}
+                        >
+                            {item.label}
+                        </Button>
+                        {
+                            !isLastItem && <ChevronRightIcon color="inherit" className={classes.item} />
+                        }
+                    </React.Fragment>
+                );
+            })
         }
     </Grid>;
 };
 
-const getInactiveItems = (items: Breadcrumb[]) => {
-    return items.slice(0, -1);
-};
-
-const getActiveItem = (items: Breadcrumb[]) => {
-    return items.slice(-1);
-};
-
-type CssRules = 'inactiveItem';
+type CssRules = "item" | "currentItem";
 
 const styles: StyleRulesCallback<CssRules> = theme => {
     const { unit } = theme.spacing;
     return {
-        inactiveItem: {
+        item: {
             opacity: 0.6
+        },
+        currentItem: {
+            opacity: 1
         }
     };
 };

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list