X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/cdc8a73914399a401642ca553e9d3d8b2d42db5c..9fe1e9ff7d9af167f0ee350ab5a68ded128d8043:/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 b81f39ef33..18aed873aa 100644 --- a/src/views-components/side-panel/side-panel.tsx +++ b/src/views-components/side-panel/side-panel.tsx @@ -2,29 +2,35 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; +import React from 'react'; import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles'; -import Drawer from '@material-ui/core/Drawer'; -import { ArvadosTheme } from '~/common/custom-theme'; -import { SidePanelTree, SidePanelTreeProps } from '~/views-components/side-panel-tree/side-panel-tree'; -import { compose, Dispatch } from 'redux'; +import { ArvadosTheme } from 'common/custom-theme'; +import { SidePanelTree, SidePanelTreeProps } from 'views-components/side-panel-tree/side-panel-tree'; +import { Dispatch } from 'redux'; import { connect } from 'react-redux'; -import { navigateFromSidePanel } from '../../store/side-panel/side-panel-action'; +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'; +import { SidePanelCollapsed } from './side-panel-collapsed'; -const DRAWER_WITDH = 240; +const DRAWER_WIDTH = 240; -type CssRules = 'drawerPaper' | 'toolbar'; +type CssRules = 'root' | 'topButtonContainer'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ - drawerPaper: { - position: 'relative', - width: DRAWER_WITDH, - display: 'flex', - flexDirection: 'column', - paddingTop: 58, - overflow: 'auto', + root: { + background: theme.palette.background.paper, + borderRight: `1px solid ${theme.palette.divider}`, + height: '100%', + overflowX: 'auto', + width: DRAWER_WIDTH, }, - toolbar: theme.mixins.toolbar + topButtonContainer: { + display: 'flex', + justifyContent: 'space-between' + } }); const mapDispatchToProps = (dispatch: Dispatch): SidePanelTreeProps => ({ @@ -33,13 +39,27 @@ const mapDispatchToProps = (dispatch: Dispatch): SidePanelTreeProps => ({ } }); -export const SidePanel = compose( - withStyles(styles), - connect(undefined, mapDispatchToProps) -)(({ classes, ...props }: WithStyles & SidePanelTreeProps) => - -
- - ); +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 & SidePanelTreeProps & { currentRoute: string }) => + + {props.isCollapsed ? + <> + + + + : + <> + + + + + + } + + ));