mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
38 lines
1002 B
JavaScript
38 lines
1002 B
JavaScript
|
|
// @flow
|
||
|
|
import React from "react";
|
||
|
|
import { translate } from "react-i18next";
|
||
|
|
import type { SelectValue } from "@scm-manager/ui-types";
|
||
|
|
import UserGroupAutocomplete from "./UserGroupAutocomplete";
|
||
|
|
|
||
|
|
type Props = {
|
||
|
|
userAutocompleteLink: string,
|
||
|
|
valueSelected: SelectValue => void,
|
||
|
|
value: string,
|
||
|
|
|
||
|
|
// Context props
|
||
|
|
t: string => string
|
||
|
|
};
|
||
|
|
|
||
|
|
class UserAutocomplete extends React.Component<Props> {
|
||
|
|
selectName = (selection: SelectValue) => {
|
||
|
|
this.props.valueSelected(selection);
|
||
|
|
};
|
||
|
|
|
||
|
|
render() {
|
||
|
|
const { userAutocompleteLink, t, value } = this.props;
|
||
|
|
return (
|
||
|
|
<UserGroupAutocomplete
|
||
|
|
autocompleteLink={userAutocompleteLink}
|
||
|
|
label={t("autocomplete.user")}
|
||
|
|
noOptionsMessage={t("autocomplete.noUserOptions")}
|
||
|
|
loadingMessage={t("autocomplete.loading")}
|
||
|
|
placeholder={t("autocomplete.userPlaceholder")}
|
||
|
|
valueSelected={this.selectName}
|
||
|
|
value={value}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export default translate("commons")(UserAutocomplete);
|