mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
default percentage and label styling
This commit is contained in:
parent
f04f3e9b29
commit
217504d574
@ -37,9 +37,8 @@ class AddStrategy extends React.Component {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div style={{ position: 'relative', width: '25px', height: '25px', display: 'inline-block' }} >
|
<div style={{ position: 'relative', width: '25px', height: '25px', display: 'inline-block' }} >
|
||||||
<IconButton name="add" id="strategies-add" colored title="Sort" onClick={this.stopPropagation}/>
|
<IconButton name="add" id="strategies-add" raised accent title="Add Strategy" onClick={this.stopPropagation}/>
|
||||||
<Menu target="strategies-add" valign="bottom" align="right" ripple style={menuStyle} onClick={
|
<Menu target="strategies-add" valign="bottom" align="right" ripple style={menuStyle}>
|
||||||
(e) => this.setSort(e.target.getAttribute('data-target'))}>
|
|
||||||
<MenuItem disabled>Add Strategy:</MenuItem>
|
<MenuItem disabled>Add Strategy:</MenuItem>
|
||||||
{this.props.strategies.map((s) => <MenuItem key={s.name} onClick={() => this.addStrategy(s.name)}>{s.name}</MenuItem>)}
|
{this.props.strategies.map((s) => <MenuItem key={s.name} onClick={() => this.addStrategy(s.name)}>{s.name}</MenuItem>)}
|
||||||
</Menu>
|
</Menu>
|
||||||
|
@ -42,10 +42,15 @@ class StrategyConfigure extends React.Component {
|
|||||||
}
|
}
|
||||||
return keys.map(field => {
|
return keys.map(field => {
|
||||||
if (strategyDefinition.parametersTemplate[field] === 'percentage') {
|
if (strategyDefinition.parametersTemplate[field] === 'percentage') {
|
||||||
|
let value = this.props.strategy.parameters[field];
|
||||||
|
if (value == null || (typeof value === 'string' && value === '')) {
|
||||||
|
value = 50; // default value
|
||||||
|
}
|
||||||
return (<StrategyInputPersentage
|
return (<StrategyInputPersentage
|
||||||
|
key={field}
|
||||||
field={field}
|
field={field}
|
||||||
onChange={this.handleConfigChange.bind(this, field)}
|
onChange={this.handleConfigChange.bind(this, field)}
|
||||||
value={this.props.strategy.parameters[field]} />);
|
value={1 * value} />);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<Textfield
|
<Textfield
|
||||||
|
@ -2,14 +2,15 @@ import React from 'react';
|
|||||||
import { Slider } from 'react-mdl';
|
import { Slider } from 'react-mdl';
|
||||||
|
|
||||||
const labelStyle = {
|
const labelStyle = {
|
||||||
margin: '0',
|
margin: '10px',
|
||||||
|
textAlign: 'center',
|
||||||
color: '#3f51b5',
|
color: '#3f51b5',
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ({ field, value, onChange }) => (
|
export default ({ field, value, onChange }) => (
|
||||||
<div>
|
<div>
|
||||||
<label style={labelStyle}>{field}: {value}%</label>
|
<div style={labelStyle}>{field}: {value}%</div>
|
||||||
<Slider min={0} max={100} defaultValue={value} value={value} onChange={onChange} label={field} />
|
<Slider min={0} max={100} defaultValue={value} value={value} onChange={onChange} label={field} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user