1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00

fix: resize (#6319)

Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
杨国璇
2024-07-09 17:00:12 +08:00
committed by GitHub
parent 1f0ac4fbc8
commit 1ae64295c9
7 changed files with 16 additions and 7 deletions

View File

@@ -4,8 +4,10 @@ import DirColumnNav from './dir-column-nav';
import DirColumnFile from './dir-column-file';
import DirListView from './dir-list-view';
import DirGridView from './dir-grid-view';
import { SIDE_PANEL_FOLDED_WIDTH } from '../../constants';
const propTypes = {
isSidePanelFolded: PropTypes.bool,
isTreePanelShown: PropTypes.bool.isRequired,
currentMode: PropTypes.string.isRequired,
path: PropTypes.string.isRequired,
@@ -99,7 +101,9 @@ class DirColumnView extends React.Component {
};
onResizeMouseMove = (e) => {
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({

View File

@@ -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 (
<div className={`side-panel ${isSidePanelFolded ? 'side-panel-folded' : ''} ${this.props.isSidePanelClosed ? '' : 'left-zero'}`}>
<div className={classnames('side-panel', { 'side-panel-folded': isSidePanelFolded, 'left-zero': !this.props.isSidePanelClosed })} style={style}>
<div className={'side-panel-north'}>
{showLogoOnlyInMobile && !Utils.isDesktop() && <Logo onCloseSidePanel={this.props.onCloseSidePanel} />}
</div>