1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 08:53:14 +00:00

[dir view] added 'sort' for mobile (#4032)

This commit is contained in:
llj
2019-08-29 15:28:54 +08:00
committed by Daniel Pan
parent 291ccf347e
commit 49f5e1e3a0
9 changed files with 42 additions and 10 deletions

View File

@@ -1,5 +1,7 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { Utils } from '../../utils/utils';
import SortOptionsDialog from '../../components/dialog/sort-options';
import DirPath from './dir-path';
import DirTool from './dir-tool';
@@ -19,7 +21,21 @@ const propTypes = {
class CurDirPath extends React.Component {
constructor(props) {
super(props);
this.state = {
isSortOptionsDialogOpen: false
};
}
toggleSortOptionsDialog = () => {
this.setState({
isSortOptionsDialogOpen: !this.state.isSortOptionsDialogOpen
});
}
render() {
const isDesktop = Utils.isDesktop();
return (
<Fragment>
<DirPath
@@ -32,6 +48,7 @@ class CurDirPath extends React.Component {
isViewFile={this.props.isViewFile}
fileTags={this.props.fileTags}
/>
{isDesktop &&
<DirTool
repoID={this.props.repoID}
repoName={this.props.repoName}
@@ -39,7 +56,17 @@ class CurDirPath extends React.Component {
currentPath={this.props.currentPath}
updateUsedRepoTags={this.props.updateUsedRepoTags}
onDeleteRepoTag={this.props.onDeleteRepoTag}
/>}
{!isDesktop && this.props.direntList.length > 0 &&
<span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
{this.state.isSortOptionsDialogOpen &&
<SortOptionsDialog
toggleDialog={this.toggleSortOptionsDialog}
sortBy={this.props.sortBy}
sortOrder={this.props.sortOrder}
sortItems={this.props.sortItems}
/>
}
</Fragment>
);
}