Merge remote-tracking branch 'origin' into 13694-Data-operations-Project-creation
[arvados.git] / src / components / side-panel / side-panel.tsx
index ecfb5f09f2c03fc3c136e35cf9b2bf3009346be8..23ee904fe40381d12bf195eaf456ea9edd796934 100644 (file)
@@ -19,36 +19,40 @@ export interface SidePanelItem {
     icon: string;
     active?: boolean;
     open?: boolean;
+    margin?: boolean;
+    openAble?: boolean;
 }
 
 interface SidePanelProps {
-    toggleSidePanelOpen: (id: string) => void;
-    toggleSidePanelActive: (id: string) => void;
+    toggleOpen: (id: string) => void;
+    toggleActive: (id: string) => void;
     sidePanelItems: SidePanelItem[];
+    handleCreationDialogOpen: () => void;
+    handleCreationDialogClose: () => void;
 }
 
 class SidePanel extends React.Component<SidePanelProps & WithStyles<CssRules>> {
     render(): ReactElement<any> {
-        const { classes, toggleSidePanelOpen, toggleSidePanelActive, sidePanelItems } = this.props;
-        const { listItemText, leftSidePanelContainer, row, list, icon, projectIcon, active, activeArrow, inactiveArrow, arrowTransition, arrowRotate } = classes;
+        const { classes, toggleOpen, toggleActive, sidePanelItems, children } = this.props;
+        const { listItemText, leftSidePanelContainer, row, list, icon, projectIconMargin, active, activeArrow, inactiveArrow, arrowTransition, arrowRotate } = classes;
         return (
             <div className={leftSidePanelContainer}>
                 <List>
                     {sidePanelItems.map(it => (
                         <span key={it.name}>
-                            <ListItem button className={list} onClick={() => toggleSidePanelActive(it.id)}>
+                            <ListItem button className={list} onClick={() => toggleActive(it.id)}>
                                 <span className={row}>
-                                    {it.name === "Projects" ? <i onClick={() => toggleSidePanelOpen(it.id)} className={`${it.active ? activeArrow : inactiveArrow} 
+                                    {it.openAble ? <i onClick={() => toggleOpen(it.id)} className={`${it.active ? activeArrow : inactiveArrow} 
                                         ${it.open ? `fas fa-caret-down ${arrowTransition}` : `fas fa-caret-down ${arrowRotate}`}`} /> : null}
                                     <ListItemIcon className={it.active ? active : ''}>
-                                        <i className={`${it.icon} ${icon} ${it.name === "Projects" ? projectIcon : ''}`} />
+                                        <i className={`${it.icon} ${icon} ${it.margin ? projectIconMargin : ''}`} />
                                     </ListItemIcon>
                                     <ListItemText className={listItemText} primary={<Typography className={it.active ? active : ''}>{it.name}</Typography>} />
                                 </span>
                             </ListItem>
-                            {it.name === "Projects" ? (
+                            {it.openAble ? (
                                 <Collapse in={it.open} timeout="auto" unmountOnExit>
-                                    {this.props.children}
+                                    {children}
                                 </Collapse>) : null}
                         </span>
                     ))}
@@ -58,7 +62,7 @@ class SidePanel extends React.Component<SidePanelProps & WithStyles<CssRules>> {
     }
 }
 
-type CssRules = 'active' | 'listItemText' | 'row' | 'leftSidePanelContainer' | 'list' | 'icon' | 'projectIcon' |
+type CssRules = 'active' | 'listItemText' | 'row' | 'leftSidePanelContainer' | 'list' | 'icon' | 'projectIconMargin' |
     'activeArrow' | 'inactiveArrow' | 'arrowRotate' | 'arrowTransition';
 
 const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
@@ -103,7 +107,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
     icon: {
         minWidth: '20px',
     },
-    projectIcon: {
+    projectIconMargin: {
         marginLeft: '17px',
     }
 });