Lint fixes

This commit is contained in:
Cmdr McDonald
2017-04-23 18:36:20 +01:00
parent 16a5b2a72a
commit 7db76ecba0
2 changed files with 6 additions and 8 deletions

View File

@@ -1,6 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import { findDOMNode } from 'react-dom';
const MARGIN_LR = 8; // Left/ Right margin
@@ -101,7 +100,7 @@ export default class Slider extends React.Component {
*/
_updateDimensions() {
this.setState({
outerWidth: findDOMNode(this).getBoundingClientRect().width
outerWidth: this.node.getBoundingClientRect().width
});
}
@@ -145,14 +144,14 @@ export default class Slider extends React.Component {
};
if (!outerWidth) {
return <svg style={style} />;
return <svg style={style} ref={node => this.node = node} />;
}
let margin = MARGIN_LR * scale;
let width = outerWidth - (margin * 2);
let pctPos = width * this.props.percent;
return <svg onMouseUp={this._up} onMouseEnter={this._enter.bind(this)} onMouseMove={this._move} onTouchEnd={this._up} style={style}>
return <svg onMouseUp={this._up} onMouseEnter={this._enter.bind(this)} onMouseMove={this._move} onTouchEnd={this._up} style={style} ref={node => this.node = node}>
<rect className='primary' style={{ opacity: 0.3 }} x={margin} y='0.25em' rx='0.3em' ry='0.3em' width={width} height='0.7em' />
<rect className='primary-disabled' x={margin} y='0.45em' rx='0.15em' ry='0.15em' width={pctPos} height='0.3em' />
<circle className='primary' r={margin} cy='0.6em' cx={pctPos + margin} />