Merge branch '21128-toolbar-context-menu'
[arvados-workbench2.git] / src / views-components / side-panel / side-panel-collapsed.tsx
index 74dfee65025cb50c892032006b34611fb8a5926f..d2f5cfec3b43b7850f8008c2977502ac1f011da8 100644 (file)
@@ -6,7 +6,7 @@ import React, { ReactElement } from 'react'
 import { connect } from 'react-redux'
 import { ProjectsIcon, ProcessIcon, FavoriteIcon, ShareMeIcon, TrashIcon, PublicFavoriteIcon, GroupsIcon } from 'components/icon/icon'
 import { TerminalIcon } from 'components/icon/icon'
-import { List, ListItem, Tooltip } from '@material-ui/core'
+import { IconButton, List, ListItem, Tooltip } from '@material-ui/core'
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles'
 import { ArvadosTheme } from 'common/custom-theme'
 import { navigateTo } from 'store/navigation/navigation-action'
@@ -22,11 +22,18 @@ import {
 } from 'store/navigation/navigation-action'
 import { navigateToUserVirtualMachines } from 'store/navigation/navigation-action'
 import { RouterAction } from 'react-router-redux'
+import { User } from 'models/user'
 
-type CssRules = 'root' | 'unselected' | 'selected'
+type CssRules = 'button' | 'unselected' | 'selected'
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    root: {},
+    button: {
+        width: '40px',
+        height: '40px',
+        paddingLeft: '-2rem',
+        marginLeft: '-0.6rem',
+        marginBottom: '-1rem'
+    },
     unselected: {
         color: theme.customs.colors.grey600,
     },
@@ -85,7 +92,7 @@ const sidePanelCollapsedCategories: TCollapsedCategory[] = [
     },
     {
         name: SidePanelCollapsedCategory.GROUPS,
-        icon: <GroupsIcon style={{marginLeft: '3px'}}/>,
+        icon: <GroupsIcon style={{marginLeft: '2px', scale: '85%'}}/>,
         navTarget: navigateToGroups,
     },
     {
@@ -95,6 +102,13 @@ const sidePanelCollapsedCategories: TCollapsedCategory[] = [
     },
 ]
 
+type SidePanelCollapsedProps = {
+    user: User;
+    selectedPath: string;
+    navToHome: (uuid: string) => void;
+    navTo: (navTarget: RouterAction | '') => void;
+};
+
 const mapStateToProps = ({auth, properties }: RootState) => {
         return {
             user: auth.user,
@@ -114,32 +128,32 @@ const mapDispatchToProps = (dispatch: Dispatch) => {
 }
 
 export const SidePanelCollapsed = withStyles(styles)(
-    connect(mapStateToProps, mapDispatchToProps)(({ classes, user, selectedPath, navToHome, navTo }: WithStyles & any) => {
+    connect(mapStateToProps, mapDispatchToProps)(({ classes, user, selectedPath, navToHome, navTo }: WithStyles & SidePanelCollapsedProps) => {
 
         const handleClick = (cat: TCollapsedCategory) => {
             if (cat.name === SidePanelCollapsedCategory.PROJECTS) navToHome(user.uuid)
             else navTo(cat.navTarget)
         }
 
-        const { root, unselected, selected } = classes
+        const { button, unselected, selected } = classes
         return (
-            <List data-cy="side-panel-collapsed" className={root}>
+            <List data-cy='side-panel-collapsed'>
                 {sidePanelCollapsedCategories.map((cat) => (
                     <ListItem
                         key={cat.name}
                         data-cy={`collapsed-${cat.name.toLowerCase().replace(/\s+/g, '-')}`}
-                        className={selectedPath === cat.name ? selected : unselected}
                         onClick={() => handleClick(cat)}
-                    >
+                        >
                         <Tooltip
+                            className={selectedPath === cat.name ? selected : unselected}
                             title={cat.name}
                             disableFocusListener
-                        >
-                            {cat.icon}
+                            >
+                            <IconButton className={button}>{cat.icon}</IconButton>
                         </Tooltip>
                     </ListItem>
                 ))}
             </List>
-        )
+        );
     })
 )