mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 13:35:44 +01:00
41 lines
916 B
JavaScript
41 lines
916 B
JavaScript
// @flow
|
|
|
|
import React from "react";
|
|
import classNames from "classnames";
|
|
|
|
type Props = {
|
|
options: string[],
|
|
optionSelected: string => void,
|
|
preselectedOption?: string,
|
|
className: any
|
|
};
|
|
|
|
class DropDown extends React.Component<Props> {
|
|
render() {
|
|
const { options, preselectedOption, className } = this.props;
|
|
return (
|
|
<div className={classNames(className, "select")}>
|
|
<select
|
|
value={preselectedOption ? preselectedOption : ""}
|
|
onChange={this.change}
|
|
>
|
|
<option key="" />
|
|
{options.map(option => {
|
|
return (
|
|
<option key={option} value={option}>
|
|
{option}
|
|
</option>
|
|
);
|
|
})}
|
|
</select>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
change = (event: SyntheticInputEvent<HTMLSelectElement>) => {
|
|
this.props.optionSelected(event.target.value);
|
|
};
|
|
}
|
|
|
|
export default DropDown;
|