<commit_before>import React from "react";

class IntroWithButton extends React.Component {
  static displayName = "Panel.IntroWithButton";

  static propTypes = {
    children: React.PropTypes.node.isRequired
  };

  render() {
    return (
      <div className="py3 px3 flex">
        {this.props.children[0]}
        <div className="ml3">
          {this.props.children[1]}
        </div>
      </div>
    );
  }
}

export default IntroWithButton;
<commit_msg>Handle case where IntroWithButton has no button<commit_after>import React from "react";

class IntroWithButton extends React.Component {
  static displayName = "Panel.IntroWithButton";

  static propTypes = {
    children: React.PropTypes.node.isRequired
  };

  render() {
    let children = React.Children.toArray(this.props.children);

    let intro;
    let button;
    if(children.length == 1) {
      intro = children;
    } else {
      button = children.pop();
      intro = children;
    }

    if(button) {
      button = (
        <div className="ml3">
          {button}
        </div>
      );
    }

    return (
      <div className="py3 px3 flex">
        {intro}
        {button}
      </div>
    );
  }
}

export default IntroWithButton;

{'fraction_non_alphanumeric': 0.11986863711001643, 'fraction_numerical': 0.007389162561576354, 'mean_word_length': 2.376731301939058, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4932120', 'n_tokens_mistral': 383, 'n_tokens_neox': 375, 'n_words': 85}