Commit cfcdbc41 authored by Laura Fuentes Grau's avatar Laura Fuentes Grau

fix for Value Widget: value and unit now connected, no large gap after resizing

parent cf41a751
...@@ -70,7 +70,7 @@ class WidgetFactory { ...@@ -70,7 +70,7 @@ class WidgetFactory {
case 'Value': case 'Value':
widget.minWidth = 70; widget.minWidth = 70;
widget.minHeight = 20; widget.minHeight = 20;
widget.width = 120; widget.width = 150;
widget.height = 30; widget.height = 30;
widget.customProperties.textSize = 16; widget.customProperties.textSize = 16;
widget.name = 'Value'; widget.name = 'Value';
......
...@@ -68,14 +68,13 @@ class WidgetValue extends Component { ...@@ -68,14 +68,13 @@ class WidgetValue extends Component {
} }
render() { render() {
var value_to_render = Number(this.state.value); let unit = " [" + this.state.unit + "]";
let value_to_render = Number(this.state.value);
return ( return (
<div className="single-value-widget"> <div className="single-value-widget">
<strong style={{ fontSize: this.props.widget.customProperties.textSize + 'px' }}>{this.props.widget.name}</strong> <strong style={{ fontSize: this.props.widget.customProperties.textSize + 'px' }}>{this.props.widget.name}</strong>
<span style={{ fontSize: this.props.widget.customProperties.textSize + 'px' }}>{Number.isNaN(value_to_render) ? NaN : format('.3s')(value_to_render)}</span> <span style={{ fontSize: this.props.widget.customProperties.textSize + 'px'}}>{Number.isNaN(value_to_render) ? NaN : format('.3s')(value_to_render)}
{this.props.widget.customProperties.showUnit && {this.props.widget.customProperties.showUnit && unit }</span>
<span style={{ fontSize: this.props.widget.customProperties.textSize + 'px' }}>[{this.state.unit}]</span>
}
</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