mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
43 lines
978 B
JavaScript
43 lines
978 B
JavaScript
// @flow
|
|
|
|
import React from "react";
|
|
import classNames from "classnames";
|
|
|
|
type Props = {
|
|
options: string[],
|
|
optionSelected: string => void,
|
|
preselectedOption?: string,
|
|
className: any,
|
|
disabled?: boolean
|
|
};
|
|
|
|
class DropDown extends React.Component<Props> {
|
|
render() {
|
|
const { options, preselectedOption, className, disabled } = this.props;
|
|
return (
|
|
<div className={classNames(className, "select")}>
|
|
<select
|
|
value={preselectedOption ? preselectedOption : ""}
|
|
onChange={this.change}
|
|
disabled={disabled}
|
|
>
|
|
<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;
|