From a2acee268bec6a64a35b1c07bde8a3d62b6d7147 Mon Sep 17 00:00:00 2001 From: Michael An <1822852997@qq.com> Date: Thu, 24 Jan 2019 17:15:01 +0800 Subject: [PATCH] permission explanation --- .../components/select-editor/select-editor.js | 47 +++++++++++-------- .../select-editor/share-permission-editor.js | 5 ++ frontend/src/css/select-editor.css | 16 +++++++ frontend/src/css/share-link-dialog.css | 14 +++++- frontend/src/utils/utils.js | 22 +++++++++ 5 files changed, 82 insertions(+), 22 deletions(-) create mode 100644 frontend/src/css/select-editor.css diff --git a/frontend/src/components/select-editor/select-editor.js b/frontend/src/components/select-editor/select-editor.js index cbed571cb6..cca2c9989d 100644 --- a/frontend/src/components/select-editor/select-editor.js +++ b/frontend/src/components/select-editor/select-editor.js @@ -1,7 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Input } from 'reactstrap'; import { gettext } from '../../utils/constants'; +import Select from 'react-select'; +import '../../css/select-editor.css'; const propTypes = { isTextMode: PropTypes.bool.isRequired, // there will be two mode. first: text and select. second: just select @@ -9,6 +10,7 @@ const propTypes = { options: PropTypes.array.isRequired, currentOption: PropTypes.string.isRequired, translateOption: PropTypes.func.isRequired, + translateExplanation: PropTypes.func, onOptionChanged: PropTypes.func.isRequired, }; @@ -19,24 +21,36 @@ class SelectEditor extends React.Component { this.state = { isEditing: false, } + this.options = []; } componentDidMount() { document.addEventListener('click', this.onHideSelect); + this.setOptions(); + } + + setOptions = () => { + this.options = []; + const options = this.props.options; + for (let i = 0, length = options.length; i < length; i++) { + let option = {}; + option.value = options[i]; + option.label =