<commit_before>import React from 'react';
import classNames from 'classnames';

import FormInputHelp from './FormInputHelp';
import FormInputErrors from './FormInputErrors';

class FormRadioGroup extends React.Component {
  static propTypes = {
    options: React.PropTypes.arrayOf(
      React.PropTypes.shape({
        className: React.PropTypes.string,
        label: React.PropTypes.string.isRequired,
        help: React.PropTypes.string,
        value: React.PropTypes.oneOfType([
          React.PropTypes.bool,
          React.PropTypes.string
        ]).isRequired
      })
    ).isRequired,
    value: React.PropTypes.oneOfType([
      React.PropTypes.bool,
      React.PropTypes.string
    ]),
    label: React.PropTypes.string,
    name: React.PropTypes.string,
    className: React.PropTypes.string,
    onChange: React.PropTypes.func,
    errors: React.PropTypes.array
  };

  inputs = []

  render() {
    return (
      <div className={classNames("mb2", this.props.className)}>
        {this.props.label && <label className="bold mb2">{this.props.label}</label>}
        {this._renderInputs()}
        {this._renderErrors()}
      </div>
    );
  }

  getValue() {
    return this.input.checked;
  }

  focus() {
    this.input.focus();
  }

  _hasErrors() {
    return this.props.errors && this.props.errors.length > 0;
  }

  _renderErrors() {
    if (this._hasErrors()) {
      return (
        <FormInputErrors errors={this.props.errors}/>
      );
    }
  }

  _renderInputs() {
    return this.props.options.map(
      (option, index) => (
        <div key={index} className="mb2">
          <label className="mb1 inline-block pl4">
            <input
              className={classNames('absolute', { "is-error": this._hasErrors() }, option.className)}
              style={{ marginLeft: '-20px' }}
              name={this.props.name}
              type="radio"<commit_msg>Tweak styling and errors of the FormRadioGroup<commit_after>import React from 'react';
import classNames from 'classnames';

import FormInputHelp from './FormInputHelp';
import FormInputErrors from './FormInputErrors';

class FormRadioGroup extends React.Component {
  static propTypes = {
    options: React.PropTypes.arrayOf(
      React.PropTypes.shape({
        className: React.PropTypes.string,
        label: React.PropTypes.string.isRequired,
        help: React.PropTypes.string,
        value: React.PropTypes.oneOfType([
          React.PropTypes.bool,
          React.PropTypes.string
        ]).isRequired
      })
    ).isRequired,
    value: React.PropTypes.oneOfType([
      React.PropTypes.bool,
      React.PropTypes.string
    ]),
    label: React.PropTypes.string,
    name: React.PropTypes.string,
    className: React.PropTypes.string,
    onChange: React.PropTypes.func,
    errors: React.PropTypes.array
  };

  inputs = []

  render() {
    return (
      <div className={classNames("mb2", this.props.className)}>
        {this.props.label && <label className={classNames("block bold", { "red": this._hasErrors() })}>{this.props.label}</label>}
        {this._renderInputs()}
        {this._renderErrors()}
      </div>
    );
  }

  getValue() {
    return this.input.checked;
  }

  focus() {
    this.input.focus();
  }

  _hasErrors() {
    return this.props.errors && this.props.errors.length > 0;
  }

  _renderErrors() {
    if (this._hasErrors()) {
      return (
        <FormInputErrors errors={this.props.errors}/>
      );
    }
  }

  _renderInputs() {
    return this.props.options.map(
      (option, index) => (
        <div key={index} className="mt1">
          <label className="mt1 inline-block pl4">
            <input
              className={classNames('absolute', { "is-error": this._hasErrors() }, option.className)}
              style={{ marginLeft: '-20px' }}
              name={this.props.name}
              type="radio"
{'fraction_non_alphanumeric': 0.1396849987090111, 'fraction_numerical': 0.0038729666924864447, 'mean_word_length': 2.521818181818182, 'pattern_counts': {'":': 3, '<': 19, '<?xml version=': 0, '>': 21, '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': '6068881', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1164, 'n_words': 212}