<commit_before>import React from 'react';
import ReactDOM from 'react-dom';
import style from './style';

class Overlay extends React.Component {
  static propTypes = {
    active: React.PropTypes.bool,
    className: React.PropTypes.string,
    onClick: React.PropTypes.func,
    opacity: React.PropTypes.number
  };

  static defaultProps = {
    opacity: 0.5
  };

  componentDidMount () {
    this.app = document.getElementById('react-toolbox-app') || document.body;
    this.node = document.createElement('div');
    this.app.appendChild(this.node);
    this.handleRender();
  }

  componentDidUpdate () {
    this.handleRender();
  }

  componentWillUnmount () {
    ReactDOM.unmountComponentAtNode(this.node);
    this.app.removeChild(this.node);
  }

  handleRender () {
    let className = style.root;
    let overlayStyle = {};
    if (this.props.active) {
      className += ` ${style.active}`;
      if (this.props.opacity) overlayStyle.opacity = this.props.opacity;<commit_msg>Set .active class only when component has a opacity > 0<commit_after>import React from 'react';
import ReactDOM from 'react-dom';
import style from './style';

class Overlay extends React.Component {
  static propTypes = {
    active: React.PropTypes.bool,
    className: React.PropTypes.string,
    onClick: React.PropTypes.func,
    opacity: React.PropTypes.number
  };

  static defaultProps = {
    opacity: 0.5
  };

  componentDidMount () {
    this.app = document.getElementById('react-toolbox-app') || document.body;
    this.node = document.createElement('div');
    this.node.setAttribute('data-react-toolbox', 'overlay');
    this.app.appendChild(this.node);
    this.handleRender();
  }

  componentDidUpdate () {
    this.handleRender();
  }

  componentWillUnmount () {
    ReactDOM.unmountComponentAtNode(this.node);
    this.app.removeChild(this.node);
  }

  handleRender () {
    let className = style.root;
    const overlayStyle = {};

    if (this.props.active) {
      if (this.props.opacity > 0) className += ` ${style.active}`;
      overlayStyle.opacity = this.props.opacity;
{'fraction_non_alphanumeric': 0.13444976076555024, 'fraction_numerical': 0.0028708133971291866, 'mean_word_length': 3.4394904458598727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '490910', 'n_tokens_mistral': 641, 'n_tokens_neox': 627, 'n_words': 125}