diff --git a/frontend/src/app.js b/frontend/src/app.js index e28725b99e..6c1a8e3370 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -255,7 +255,7 @@ class App extends Component { - + { - let sizeNavWidth = this.containerWidth / 0.78 * 0.22 + 3; + const { isSidePanelFolded } = this.props; + let sizeNavWidth = isSidePanelFolded ? SIDE_PANEL_FOLDED_WIDTH + 3 : this.containerWidth / 0.78 * 0.22 + 3; + let rate = (e.nativeEvent.clientX - sizeNavWidth) / this.containerWidth; if (rate < 0.1) { this.setState({ diff --git a/frontend/src/components/side-panel.js b/frontend/src/components/side-panel.js index a3fdd02f3d..6b4f9e3f73 100644 --- a/frontend/src/components/side-panel.js +++ b/frontend/src/components/side-panel.js @@ -1,8 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; +import classnames from 'classnames'; import { Utils } from '../utils/utils'; import Logo from './logo'; import MainSideNav from './main-side-nav'; +import { SIDE_PANEL_FOLDED_WIDTH } from '../constants'; const propTypes = { isSidePanelClosed: PropTypes.bool, @@ -19,8 +21,9 @@ class SidePanel extends React.Component { render() { const { children, isSidePanelFolded, showLogoOnlyInMobile = false } = this.props; + const style = isSidePanelFolded ? { flexBasis: SIDE_PANEL_FOLDED_WIDTH } : {}; return ( -
+
{showLogoOnlyInMobile && !Utils.isDesktop() && }
diff --git a/frontend/src/constants/index.js b/frontend/src/constants/index.js index 12c5633eee..2d0bef703b 100644 --- a/frontend/src/constants/index.js +++ b/frontend/src/constants/index.js @@ -113,4 +113,6 @@ export const PRIVATE_FILE_TYPE = { const TAG_COLORS = ['#FBD44A', '#EAA775', '#F4667C', '#DC82D2', '#9860E5', '#9F8CF1', '#59CB74', '#ADDF84', '#89D2EA', '#4ECCCB', '#46A1FD', '#C2C2C2']; +export const SIDE_PANEL_FOLDED_WIDTH = 69; + export { KeyCodes, zIndexes, TAG_COLORS }; diff --git a/frontend/src/css/layout.css b/frontend/src/css/layout.css index 0bc2688469..5b20df663b 100644 --- a/frontend/src/css/layout.css +++ b/frontend/src/css/layout.css @@ -29,10 +29,6 @@ background: #fff; } -.side-panel-folded { - flex-basis: 69px; -} - .user-panel .side-panel-north { height: 49px; } diff --git a/frontend/src/pages/lib-content-view/lib-content-container.js b/frontend/src/pages/lib-content-view/lib-content-container.js index 3bf3619381..883ce0f5ce 100644 --- a/frontend/src/pages/lib-content-view/lib-content-container.js +++ b/frontend/src/pages/lib-content-view/lib-content-container.js @@ -10,6 +10,7 @@ import ToolbarForSelectedDirents from '../../components/toolbar/selected-dirents import '../../css/lib-content-view.css'; const propTypes = { + isSidePanelFolded: PropTypes.bool, switchViewMode: PropTypes.func.isRequired, isCustomPermission: PropTypes.bool, @@ -249,6 +250,7 @@ class LibContentContainer extends React.Component { {!this.props.pathExist && this.errMessage} {this.props.pathExist && (