<commit_before>// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP

import React, { Component, PropTypes } from 'react';

const CLASS_ROOT = "button";

class Button extends Component {
  render () {
    var classes = [CLASS_ROOT];
    if (this.props.primary) {
      classes.push(CLASS_ROOT + "--primary");
    }
    if (this.props.secondary) {
      classes.push(CLASS_ROOT + "--secondary");
    }
    if (this.props.accent) {
      classes.push(CLASS_ROOT + "--accent");
    }
    if (! this.props.onClick) {
      classes.push(CLASS_ROOT + "--disabled");
    }
    if (this.props.fill) {
      classes.push(CLASS_ROOT + "--fill");
    }
    if (this.props.className) {
      classes.push(this.props.className);
    }

    var type = this.props.type;
    if (this.props.type === 'icon') {
      classes.push(CLASS_ROOT + "--icon");
      type = 'button';
    }

    var children = React.Children.map(this.props.children, function (child) {
      if (child && child.type && 'Icon' === child.type.name) {
        return <span className={CLASS_ROOT + "__icon"}>{child}</span>;
      } else {
        return child;
      }
    });
    if (! children) {
      children = this.props.label;
    }

    return (
      <button id={this.props.id} type={type} className={classes.join(' ')}
        onClick={this.props.onClick} disabled={! this.props.onClick}>
        {children}
      </button>
    );
  }
}

Button.propTypes = {
  accent: PropTypes.bool,
  fill: PropTypes.bool,<commit_msg>Added proper check for icon instance.<commit_after>// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP

import React, { Component, PropTypes } from 'react';

const CLASS_ROOT = "button";

class Button extends Component {
  render () {
    var classes = [CLASS_ROOT];
    if (this.props.primary) {
      classes.push(CLASS_ROOT + "--primary");
    }
    if (this.props.secondary) {
      classes.push(CLASS_ROOT + "--secondary");
    }
    if (this.props.accent) {
      classes.push(CLASS_ROOT + "--accent");
    }
    if (! this.props.onClick) {
      classes.push(CLASS_ROOT + "--disabled");
    }
    if (this.props.fill) {
      classes.push(CLASS_ROOT + "--fill");
    }
    if (this.props.className) {
      classes.push(this.props.className);
    }

    var type = this.props.type;
    if (this.props.type === 'icon') {
      classes.push(CLASS_ROOT + "--icon");
      type = 'button';
    }

    var children = React.Children.map(this.props.children, function (child) {
      if (child && child.icon) {
        return <span className={CLASS_ROOT + "__icon"}>{child}</span>;
      } else {
        return child;
      }
    });
    if (! children) {
      children = this.props.label;
    }

    return (
      <button id={this.props.id} type={type} className={classes.join(' ')}
        onClick={this.props.onClick} disabled={! this.props.onClick}>
        {children}
      </button>
    );
  }
}

Button.propTypes = {
  accent: PropTypes.bool,
  fill: PropTypes.bool,
{'fraction_non_alphanumeric': 0.16176470588235295, 'fraction_numerical': 0.0053475935828877, 'mean_word_length': 2.5005847953216374, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6690334', 'n_tokens_mistral': 962, 'n_tokens_neox': 947, 'n_words': 192}