Render should be last method declared
This commit is contained in:
parent
787e408016
commit
4d0cac1260
1 changed files with 5 additions and 5 deletions
|
@ -35,6 +35,10 @@ export default class Slider extends React.Component {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_offset(values, value) {
|
||||||
|
return (value - values[0]) / (values[values.length - 1] - values[0]) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const dots = this.props.values.map(v =>
|
const dots = this.props.values.map(v =>
|
||||||
<Dot active={v<=this.props.value}
|
<Dot active={v<=this.props.value}
|
||||||
|
@ -43,7 +47,7 @@ export default class Slider extends React.Component {
|
||||||
key={v}
|
key={v}
|
||||||
/>);
|
/>);
|
||||||
|
|
||||||
const offset = this.offset(this.props.values, this.props.value);
|
const offset = this._offset(this.props.values, this.props.value);
|
||||||
|
|
||||||
return <div className="mx_fontSlider">
|
return <div className="mx_fontSlider">
|
||||||
<div>
|
<div>
|
||||||
|
@ -60,10 +64,6 @@ export default class Slider extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset(values, value) {
|
|
||||||
return (value - values[0]) / (values[values.length - 1] - values[0]) * 100;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Dot extends React.Component {
|
class Dot extends React.Component {
|
||||||
|
|
Loading…
Reference in a new issue