<commit_before>import React, { PropTypes } from 'react';
import Overlay from './Overlay';
import idgen from './idgen';

class OverlayTrigger extends Overlay {
  constructor (props) {
    super(props);
    this.showOverlay = this.showOverlay.bind(this);
    this.renderOverlay = this.renderOverlay.bind(this);
    this.overlayID = this.props.overlay.props.id || `overlay_${idgen()}`;
  }

  render () {
    const child = React.Children.only(this.props.children);

    return React.cloneElement(
      child, {
        onClick: this.showOverlay
      }
    );
  }

  renderOverlay () {
    return React.cloneElement(this.props.overlay, {
      id: this.overlayID
    });
  }

  showOverlay () {
    $(`#${this.overlayID}`).modal(this.props.modalOptions).modal('open');
  }
}

OverlayTrigger.propTypes = {
  modalOptions: PropTypes.object,
  overlay: PropTypes.node<commit_msg>#170 prevent modal trigger from triggering default event<commit_after>import React, { PropTypes } from 'react';
import Overlay from './Overlay';
import idgen from './idgen';

class OverlayTrigger extends Overlay {
  constructor (props) {
    super(props);
    this.showOverlay = this.showOverlay.bind(this);
    this.renderOverlay = this.renderOverlay.bind(this);
    this.overlayID = this.props.overlay.props.id || `overlay_${idgen()}`;
  }

  render () {
    const child = React.Children.only(this.props.children);

    return React.cloneElement(
      child, {
        onClick: this.showOverlay
      }
    );
  }

  renderOverlay () {
    return React.cloneElement(this.props.overlay, {
      id: this.overlayID
    });
  }

  showOverlay (e) {
    e.preventDefault();
    $(`#${this.overlayID}`).modal(this.props.modalOptions).modal('open');
  }
}

OverlayTrigger.propTypes = {
  modalOptions: PropTypes.object,
  overlay: PropTypes.node
{'fraction_non_alphanumeric': 0.14262114537444934, 'fraction_numerical': 0.0016519823788546256, 'mean_word_length': 3.4101941747572817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7210121', 'n_tokens_mistral': 564, 'n_tokens_neox': 581, 'n_words': 104}