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 (
|
||||
<div style={{ position: 'relative', width: '25px', height: '25px', display: 'inline-block' }} >
|
||||
<IconButton name="add" id="strategies-add" colored title="Sort" onClick={this.stopPropagation}/>
|
||||
<Menu target="strategies-add" valign="bottom" align="right" ripple style={menuStyle} onClick={
|
||||
(e) => this.setSort(e.target.getAttribute('data-target'))}>
|
||||
<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}>
|
||||
<MenuItem disabled>Add Strategy:</MenuItem>
|
||||
{this.props.strategies.map((s) => <MenuItem key={s.name} onClick={() => this.addStrategy(s.name)}>{s.name}</MenuItem>)}
|
||||
</Menu>
|
||||
|
@ -42,10 +42,15 @@ class StrategyConfigure extends React.Component {
|
||||
}
|
||||
return keys.map(field => {
|
||||
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
|
||||
key={field}
|
||||
field={field}
|
||||
onChange={this.handleConfigChange.bind(this, field)}
|
||||
value={this.props.strategy.parameters[field]} />);
|
||||
value={1 * value} />);
|
||||
} else {
|
||||
return (
|
||||
<Textfield
|
||||
|
@ -2,14 +2,15 @@ import React from 'react';
|
||||
import { Slider } from 'react-mdl';
|
||||
|
||||
const labelStyle = {
|
||||
margin: '0',
|
||||
margin: '10px',
|
||||
textAlign: 'center',
|
||||
color: '#3f51b5',
|
||||
fontSize: '12px',
|
||||
};
|
||||
|
||||
export default ({ field, value, onChange }) => (
|
||||
<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} />
|
||||
</div>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user