X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3c7e3cdc547ad5468421e1c049daa94b0d4b8bc0..273119605b7f33940a5ef9b1422eb1ff152d6764:/src/views-components/side-panel/side-panel.tsx

diff --git a/src/views-components/side-panel/side-panel.tsx b/src/views-components/side-panel/side-panel.tsx
index 218b624cd5..4953022d66 100644
--- a/src/views-components/side-panel/side-panel.tsx
+++ b/src/views-components/side-panel/side-panel.tsx
@@ -12,10 +12,11 @@ import { navigateFromSidePanel } from 'store/side-panel/side-panel-action';
 import { Grid } from '@material-ui/core';
 import { SidePanelButton } from 'views-components/side-panel-button/side-panel-button';
 import { RootState } from 'store/store';
+import SidePanelToggle from 'views-components/side-panel-toggle/side-panel-toggle';
 
-const DRAWER_WITDH = 240;
+const DRAWER_WIDTH = 240;
 
-type CssRules = 'root';
+type CssRules = 'root' | 'topButtonContainer';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     root: {
@@ -23,7 +24,11 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
         borderRight: `1px solid ${theme.palette.divider}`,
         height: '100%',
         overflowX: 'auto',
-        width: DRAWER_WITDH,
+        width: DRAWER_WIDTH,
+    },
+    topButtonContainer: {
+        display: 'flex',
+        justifyContent: 'space-between'
     }
 });
 
@@ -33,15 +38,22 @@ const mapDispatchToProps = (dispatch: Dispatch): SidePanelTreeProps => ({
     }
 });
 
-const mapStateToProps = ({ router }: RootState) => ({
+const mapStateToProps = ({ router, sidePanel }: RootState) => ({
     currentRoute: router.location ? router.location.pathname : '',
+    isCollapsed: sidePanel.collapsedState
 });
 
 export const SidePanel = withStyles(styles)(
     connect(mapStateToProps, mapDispatchToProps)(
         ({ classes, ...props }: WithStyles<CssRules> & SidePanelTreeProps & { currentRoute: string }) =>
             <Grid item xs>
-                <SidePanelButton key={props.currentRoute} />
-                <SidePanelTree {...props} />
+                {props.isCollapsed ? <SidePanelToggle /> :
+                <>
+                    <Grid className={classes.topButtonContainer}>
+                        <SidePanelButton key={props.currentRoute} />
+                        <SidePanelToggle/>
+                    </Grid>
+                    <SidePanelTree {...props} />
+                </>}
             </Grid>
     ));
