Skip to content
This repository was archived by the owner on May 15, 2022. It is now read-only.

Commit f6ea20b

Browse files
Merge pull request #32 from rin3s/master
Added possibility to use custom item names for DatSelect items.
2 parents 0024227 + 61b2ce7 commit f6ea20b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/DatSelect.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default class DatSelect extends Component {
1010
path: PropTypes.string,
1111
label: PropTypes.string,
1212
options: PropTypes.array.isRequired,
13+
optionLabels: PropTypes.array,
1314
labelWidth: PropTypes.number,
1415
liveUpdate: PropTypes.bool,
1516
onUpdate: PropTypes.func,
@@ -47,7 +48,7 @@ export default class DatSelect extends Component {
4748
}
4849

4950
render() {
50-
const { path, label, labelWidth } = this.props;
51+
const { path, label, labelWidth, optionLabels } = this.props;
5152
const { value, options } = this.state;
5253
const labelText = isString(label) ? label : path;
5354

@@ -62,7 +63,7 @@ export default class DatSelect extends Component {
6263
style={{ width: `${100 - labelWidth}%` }}
6364
onChange={this.handleChange}
6465
>
65-
{options.map((item, index) => <option key={index} value={item}>{item}</option>)}
66+
{options.map((item, index) => <option key={index} value={item}>{optionLabels ? optionLabels[index] : item}</option>)}
6667
</select>
6768
</label>
6869
</li>

0 commit comments

Comments
 (0)