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

Select editor encapsulate (#2794)

This commit is contained in:
杨顺强
2019-01-09 14:39:17 +08:00
committed by Daniel Pan
parent 44af7136bf
commit 9c230cc5db
10 changed files with 123 additions and 49 deletions

View File

@@ -0,0 +1,42 @@
import React from 'react';
import PropTypes from 'prop-types';
import { gettext } from '../../utils/constants';
import SelectEditor from './select-editor';
const propTypes = {
isTextMode: PropTypes.bool.isRequired,
isEditIconShow: PropTypes.bool.isRequired,
roles: PropTypes.array.isRequired,
currentRole: PropTypes.string.isRequired,
onRoleChangedHandler: PropTypes.func.isRequired,
};
class RoleEditor extends React.Component {
translateRole = (role) => {
if (role === 'Admin') {
return gettext('Admin');
}
if (role === 'Member') {
return gettext('Member');
}
}
render() {
return (
<SelectEditor
isTextMode={this.props.isTextMode}
isEditIconShow={this.props.isEditIconShow}
options={this.props.roles}
currentOption={this.props.currentRole}
onOptionChangedHandler={this.props.onRoleChangedHandler}
translateOption={this.translateRole}
/>
);
}
}
RoleEditor.propTypes = propTypes;
export default RoleEditor;