1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { Tooltip, IconButton } from '@material-ui/core';
7 import { connect } from 'react-redux';
8 import { toggleSidePanel } from "store/side-panel/side-panel-action";
9 import { RootState } from 'store/store';
11 type collapseButtonProps = {
13 toggleSidePanel: (collapsedState: boolean) => void
16 export const COLLAPSE_ICON_SIZE = 35
18 const SidePanelToggle = (props: collapseButtonProps) =>{
19 const collapseButtonIconStyles = {
21 width: `${COLLAPSE_ICON_SIZE}px`,
30 return <Tooltip disableFocusListener title="Toggle Side Panel">
31 <IconButton style={collapseButtonIconStyles.root} onClick={()=>{props.toggleSidePanel(props.isCollapsed)}}>
34 <img style={collapseButtonIconStyles.icon} src='arrow-to-right.png'/>
36 <img style={{...collapseButtonIconStyles.icon, marginRight: '0.5rem'}} src='arrow-to-left.png'/>}
42 const mapStateToProps = (state: RootState) => {
44 isCollapsed: state.sidePanel.collapsedState
48 const mapDispatchToProps = (dispatch) => {
50 toggleSidePanel: (collapsedState)=>{
51 return dispatch(toggleSidePanel(collapsedState))
56 export default connect(mapStateToProps, mapDispatchToProps)(SidePanelToggle)