mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 21:30:39 +00:00
fix folded nav animation (#6639)
This commit is contained in:
@@ -33,6 +33,14 @@ class MainSideNavFolded extends React.Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.addEventListener('click', this.handleOutsideClick);
|
document.addEventListener('click', this.handleOutsideClick);
|
||||||
|
seafileAPI.listGroups().then(res => {
|
||||||
|
this.setState({
|
||||||
|
groupItems: res.data.map(item => new Group(item)).sort((a, b) => a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1),
|
||||||
|
});
|
||||||
|
}).catch(error => {
|
||||||
|
let errMessage = Utils.getErrorMsg(error);
|
||||||
|
toaster.danger(errMessage);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@@ -48,27 +56,12 @@ class MainSideNavFolded extends React.Component {
|
|||||||
|
|
||||||
openSubNav = () => {
|
openSubNav = () => {
|
||||||
if (this.state.isFilesSubNavShown) return;
|
if (this.state.isFilesSubNavShown) return;
|
||||||
seafileAPI.listGroups().then(res => {
|
this.setState({ isFilesSubNavShown: true });
|
||||||
this.canCloseNav = false;
|
|
||||||
this.setState({
|
|
||||||
groupItems: res.data.map(item => new Group(item)).sort((a, b) => a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1),
|
|
||||||
isFilesSubNavShown: true
|
|
||||||
}, () => {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.canCloseNav = true;
|
|
||||||
}, 500);
|
|
||||||
});
|
|
||||||
}).catch(error => {
|
|
||||||
let errMessage = Utils.getErrorMsg(error);
|
|
||||||
toaster.danger(errMessage);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
closeSubNav = () => {
|
closeSubNav = () => {
|
||||||
if (!this.state.isFilesSubNavShown || !this.canCloseNav) return;
|
if (!this.state.isFilesSubNavShown) return;
|
||||||
this.setState({
|
this.setState({ isFilesSubNavShown: false });
|
||||||
isFilesSubNavShown: false
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tabItemClick = (e, param, id) => {
|
tabItemClick = (e, param, id) => {
|
||||||
@@ -124,7 +117,7 @@ class MainSideNavFolded extends React.Component {
|
|||||||
<div className="side-nav side-nav-folded h-100 position-relative" style={{ zIndex: FOLDED_SIDE_NAV }}>
|
<div className="side-nav side-nav-folded h-100 position-relative" style={{ zIndex: FOLDED_SIDE_NAV }}>
|
||||||
<div className='side-nav-con d-flex flex-column'>
|
<div className='side-nav-con d-flex flex-column'>
|
||||||
<ul className="nav nav-pills flex-column nav-container">
|
<ul className="nav nav-pills flex-column nav-container">
|
||||||
<li className={`nav-item flex-column ${this.getActiveClass('libraries')}`} onClick={this.openSubNav}>
|
<li className={`nav-item flex-column ${this.getActiveClass('libraries')}`}>
|
||||||
<Link
|
<Link
|
||||||
to={ siteRoot + 'libraries/' }
|
to={ siteRoot + 'libraries/' }
|
||||||
className={`nav-link ellipsis ${this.getActiveClass('libraries')}`}
|
className={`nav-link ellipsis ${this.getActiveClass('libraries')}`}
|
||||||
|
Reference in New Issue
Block a user