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 React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { findDOMNode } from 'react-dom';
import cn from 'classnames'; import cn from 'classnames';
import TranslatedComponent from './TranslatedComponent'; import TranslatedComponent from './TranslatedComponent';
import Router from '../Router'; import Router from '../Router';
@@ -460,8 +459,8 @@ export default class ModalImport extends TranslatedComponent {
* If textarea is shown focus on mount * If textarea is shown focus on mount
*/ */
componentDidMount() { componentDidMount() {
if (!this.props.builds && findDOMNode(this.refs.importField)) { if (!this.props.builds && this.importField) {
findDOMNode(this.refs.importField).focus(); this.importField.focus();
} }
} }
@@ -477,7 +476,7 @@ export default class ModalImport extends TranslatedComponent {
if (!state.processed) { if (!state.processed) {
importStage = ( importStage = (
<div> <div>
<textarea className='cb json' ref='importField' onChange={this._validateImport} defaultValue={this.state.importString} placeholder={translate('PHRASE_IMPORT')} /> <textarea className='cb json' ref={node => this.importField = node} onChange={this._validateImport} defaultValue={this.state.importString} placeholder={translate('PHRASE_IMPORT')} />
<button id='proceed' className='l cap' onClick={this._process} disabled={!state.importValid} >{translate('proceed')}</button> <button id='proceed' className='l cap' onClick={this._process} disabled={!state.importValid} >{translate('proceed')}</button>
<div className='l warning' style={{ marginLeft:'3em' }}>{state.errorMsg}</div> <div className='l warning' style={{ marginLeft:'3em' }}>{state.errorMsg}</div>
</div> </div>

View File

@@ -1,6 +1,5 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { findDOMNode } from 'react-dom';
const MARGIN_LR = 8; // Left/ Right margin const MARGIN_LR = 8; // Left/ Right margin
@@ -101,7 +100,7 @@ export default class Slider extends React.Component {
*/ */
_updateDimensions() { _updateDimensions() {
this.setState({ 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) { if (!outerWidth) {
return <svg style={style} />; return <svg style={style} ref={node => this.node = node} />;
} }
let margin = MARGIN_LR * scale; let margin = MARGIN_LR * scale;
let width = outerWidth - (margin * 2); let width = outerWidth - (margin * 2);
let pctPos = width * this.props.percent; 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' 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' /> <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} /> <circle className='primary' r={margin} cy='0.6em' cx={pctPos + margin} />