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

Change user select message (#4576)

* change user select

* change select user to search user
This commit is contained in:
Michael An
2020-06-03 15:50:13 +08:00
committed by GitHub
parent 7da8e55d68
commit 8a90b33ad8
13 changed files with 30 additions and 19 deletions

View File

@@ -11,12 +11,7 @@ const propTypes = {
onSelectChange: PropTypes.func.isRequired,
isMulti: PropTypes.bool.isRequired,
className: PropTypes.string,
};
const NoOptionsMessage = (props) => {
return (
<div {...props.innerProps} style={{margin: '6px 10px', textAlign: 'center', color: 'hsl(0,0%,50%)'}}>{gettext('User not found')}</div>
);
value: PropTypes.string,
};
class UserSelect extends React.Component {
@@ -24,6 +19,13 @@ class UserSelect extends React.Component {
constructor(props) {
super(props);
this.options = [];
this.state = {
searchValue: '',
};
}
onInputChange = (searchValue) => {
this.setState({ searchValue });
}
handleSelectChange = (option) => {
@@ -61,14 +63,23 @@ class UserSelect extends React.Component {
}
render() {
const searchValue = this.state.searchValue;
const style = { margin: '6px 10px', textAlign: 'center', color: 'hsl(0,0%,50%)' };
return (
<AsyncSelect
isClearable
classNamePrefix
components={{ NoOptionsMessage }}
components={{
NoOptionsMessage: (props) => {
return (
<div {...props.innerProps} style={style}>{searchValue ? gettext('User not found') : gettext('Enter characters to start searching')}</div>
);
}
}}
isMulti={this.props.isMulti}
loadOptions={this.loadOptions}
onChange={this.handleSelectChange}
onInputChange={this.onInputChange}
placeholder={this.props.placeholder}
className={`user-select ${this.props.className}`}
value={this.props.value}