Field: make id optional, generate one if not provided

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-03-29 22:59:15 +01:00
parent 7bdd22ae03
commit 19aae087e0
31 changed files with 36 additions and 57 deletions

View file

@ -132,7 +132,7 @@ export default createReactClass({
const label = typeof this.props.label === "undefined" ? _t("Power level") : this.props.label;
if (this.state.custom) {
picker = (
<Field id={`powerSelector_custom_${this.props.powerLevelKey}`} type="number"
<Field type="number"
label={label} max={this.props.maxValue}
onBlur={this.onCustomBlur} onKeyDown={this.onCustomKeyDown} onChange={this.onCustomChange}
value={String(this.state.customValue)} disabled={this.props.disabled} />
@ -151,7 +151,7 @@ export default createReactClass({
});
picker = (
<Field id={`powerSelector_notCustom_${this.props.powerLevelKey}`} element="select"
<Field element="select"
label={label} onChange={this.onSelectChange}
value={String(this.state.selectValue)} disabled={this.props.disabled}>
{options}