mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 22:15:45 +01:00
add optionValues to the DropDow component
This commit is contained in:
@@ -5,6 +5,7 @@ import classNames from "classnames";
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
options: string[],
|
options: string[],
|
||||||
|
optionValues?: string[],
|
||||||
optionSelected: string => void,
|
optionSelected: string => void,
|
||||||
preselectedOption?: string,
|
preselectedOption?: string,
|
||||||
className: any,
|
className: any,
|
||||||
@@ -13,7 +14,7 @@ type Props = {
|
|||||||
|
|
||||||
class DropDown extends React.Component<Props> {
|
class DropDown extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { options, preselectedOption, className, disabled } = this.props;
|
const { options, optionValues, preselectedOption, className, disabled } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className={classNames(className, "select")}>
|
<div className={classNames(className, "select")}>
|
||||||
<select
|
<select
|
||||||
@@ -22,9 +23,9 @@ class DropDown extends React.Component<Props> {
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
<option key="" />
|
<option key="" />
|
||||||
{options.map(option => {
|
{options.map((option, index) => {
|
||||||
return (
|
return (
|
||||||
<option key={option} value={option}>
|
<option key={option} value={optionValues && optionValues[index] ? optionValues[index] : option}>
|
||||||
{option}
|
{option}
|
||||||
</option>
|
</option>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user