mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-14 23:46:49 +00:00
* [my libs] fixed the operation menu items for library items in mobile after reactstrap was upgraded from v8 to v9 - after the upgrade for reacstrap, the operation menu items fail to work * [shared dir view] fixed the operation menu items in mobile * [new component] added a new component 'MobileItemMenu' for items' operation menu in mobile * [user settings] linked devices: fixed the operation menus in mobile * [library content view] fixed the operation menus in mobile * [department/group repo list, shared with all] fixed the operation menus in mobile * [shared with me] fixed the operation menus in mobile * [Favorites] fixed the operation menus in mobile * [share admin / libraries] fixed the operation menus in mobile * [share admin / folders] fixed the operation menus in mobile * [share admin / share links] fixed the operation menus in mobile * [share admin / upload links] fixed the operation menus in mobile * [linked devices] fixed the operation menus in mobile * [invite guest] fixed the operation menus in mobile * [repo trash dialog] fixed the operation menus in mobile
58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
/* this component works only as an operation menu for an item(such as a library item, a folder/file item) in mobile */
|
|
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { Dropdown, DropdownToggle, DropdownMenu } from 'reactstrap';
|
|
import { gettext } from '../utils/constants';
|
|
|
|
const propTypes = {
|
|
isOpen: PropTypes.bool,
|
|
toggle: PropTypes.func,
|
|
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired
|
|
};
|
|
|
|
class MobileItemMenu extends React.Component {
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
isOpMenuOpen: false
|
|
};
|
|
}
|
|
|
|
toggleOpMenu = () => {
|
|
this.setState({ isOpMenuOpen: !this.state.isOpMenuOpen });
|
|
};
|
|
|
|
render() {
|
|
const { isOpen, toggle, children } = this.props;
|
|
const { isOpMenuOpen } = this.state;
|
|
const isMenuOpen = isOpen != undefined ? isOpen : isOpMenuOpen;
|
|
const toggleMenu = toggle || this.toggleOpMenu;
|
|
return (
|
|
<Dropdown isOpen={isMenuOpen} toggle={toggleMenu}>
|
|
<DropdownToggle
|
|
tag="i"
|
|
className="sf-dropdown-toggle sf3-font sf3-font-more-vertical ml-0"
|
|
title={gettext('More operations')}
|
|
aria-label={gettext('More operations')}
|
|
data-toggle="dropdown"
|
|
aria-expanded={isMenuOpen}
|
|
/>
|
|
<DropdownMenu
|
|
container={document.body}
|
|
className="mobile-dropdown-menu"
|
|
>
|
|
<div className="mobile-operation-menu-bg-layer" onClick={toggleMenu}></div>
|
|
<div className="mobile-operation-menu">
|
|
{children}
|
|
</div>
|
|
</DropdownMenu>
|
|
</Dropdown>
|
|
);
|
|
}
|
|
}
|
|
|
|
MobileItemMenu.propTypes = propTypes;
|
|
|
|
export default MobileItemMenu;
|