replaced eslint:recommended with prettier

This commit is contained in:
Wyatt Johnson
2018-01-11 20:00:34 -07:00
parent d56c19016a
commit 0abc2ca243
649 changed files with 16235 additions and 13008 deletions
@@ -1,6 +1,6 @@
import {Component, cloneElement, Children} from 'react';
import { Component, cloneElement, Children } from 'react';
import PropTypes from 'prop-types';
import {findDOMNode} from 'react-dom';
import { findDOMNode } from 'react-dom';
export default class ClickOutside extends Component {
static propTypes = {
@@ -14,15 +14,15 @@ export default class ClickOutside extends Component {
domNode = null;
handleClick = (e) => {
const {onClickOutside} = this.props;
handleClick = e => {
const { onClickOutside } = this.props;
if (!e || !this.domNode.contains(e.target)) {
onClickOutside && onClickOutside(e);
}
};
componentDidMount() {
const {pym} = this.context;
const { pym } = this.context;
this.domNode = findDOMNode(this);
document.addEventListener('click', this.handleClick, true);
if (pym) {
@@ -31,15 +31,17 @@ export default class ClickOutside extends Component {
}
componentWillUnmount() {
const {pym} = this.context;
const { pym } = this.context;
document.removeEventListener('click', this.handleClick, true);
if (pym) {
pym.messageHandlers.click = pym.messageHandlers.click.filter((h) => h !== this.handleClick);
pym.messageHandlers.click = pym.messageHandlers.click.filter(
h => h !== this.handleClick
);
}
}
render() {
const {children, onClickOutside: _, ...rest} = this.props;
const { children, onClickOutside: _, ...rest } = this.props;
return cloneElement(Children.only(children), rest);
}
}