Commit a0a06911 by Peter Holmberg

Toggle buttons

parent 368f1f67
...@@ -88,7 +88,7 @@ export default class MappingRow extends PureComponent<Props, State> { ...@@ -88,7 +88,7 @@ export default class MappingRow extends PureComponent<Props, State> {
const valueMap = mapping as ValueMap; const valueMap = mapping as ValueMap;
return ( return (
<div className="gf-form-inline"> <div className="gf-form">
<div className="gf-form-inline"> <div className="gf-form-inline">
<Label width={4}>Value</Label> <Label width={4}>Value</Label>
<input className="gf-form-input" onChange={this.onMappingValueChange} value={valueMap.value} /> <input className="gf-form-input" onChange={this.onMappingValueChange} value={valueMap.value} />
...@@ -105,36 +105,34 @@ export default class MappingRow extends PureComponent<Props, State> { ...@@ -105,36 +105,34 @@ export default class MappingRow extends PureComponent<Props, State> {
const { mappingType } = this.state; const { mappingType } = this.state;
return ( return (
<div> <div className="gf-form-inline">
<div className="gf-form-inline"> <ToggleButtonGroup
<ToggleButtonGroup onChange={mappingType => this.onMappingTypeChange(mappingType)}
label="Mapping type" value={mappingType}
onChange={mappingType => this.onMappingTypeChange(mappingType)} render={({ selectedValue, onChange }) => {
render={({ selectedValue, onChange }) => { return [
return [ <ToggleButton
<ToggleButton className="btn-small"
className="btn-small" key="value"
key="value" onChange={onChange}
onChange={onChange} selected={selectedValue === MappingType.ValueToText}
selected={selectedValue === mappingType} value={MappingType.ValueToText}
value="Value" >
> Value
Value </ToggleButton>,
</ToggleButton>, <ToggleButton
<ToggleButton className="btn-small"
className="btn-small" key="range"
key="range" onChange={onChange}
onChange={onChange} selected={selectedValue === MappingType.RangeToText}
selected={selectedValue === mappingType} value={MappingType.RangeToText}
value="Range" >
> Range
Range </ToggleButton>,
</ToggleButton>, ];
]; }}
}} />
/> <div>{this.renderRow()}</div>
<div>{this.renderRow()}</div>
</div>
</div> </div>
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment