<commit_before>import React, {PropTypes} from 'react';
import {uniqueId} from 'lodash';

import Icon from '../Icon/Icon';
import s from './Radio.css';

export default class Radio {
  constructor(props) {
    this.id = uniqueId('radio');
  }
  render() {
    const {
      name,
      value,
      tabbed,
      tabIcon,
      onChange,
      className,
      selectedValue,
    } = this.props;
    const isChecked = value === selectedValue;
    return (
      <span className={[s.child, className].join(' ')}>
        <input id={this.id}
               type="radio"
               className={tabbed ? s.tab : s.radio}
               checked={isChecked}
               name={this.props.name}
               onChange={() => this.props.onChange(this.props.value)} />
        <label htmlFor={this.id}
               className={tabbed ? s.tabLabel : s.radioLabel}>
          {tabbed ?
            <span>
              <Icon className={s.tabIcon} name={tabIcon}/>
              {value}
            </span>
            :
            value
          }
        </label>
      </span>
    );
  }
}

Radio.propTypes = {
  name: PropTypes.string.isRequired,
  onChange: PropTypes.func.isRequired,

  // The value of the parent group
  selectedValue: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
  ]),

  // The value of this radio
  value: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
  ]),
  className: PropTypes.string,
  children: PropTypes.any,<commit_msg>Radio renders children if they exist<commit_after>import React, {PropTypes} from 'react';
import {uniqueId} from 'lodash';

import Icon from '../Icon/Icon';
import s from './Radio.css';

export default class Radio {
  constructor(props) {
    this.id = uniqueId('radio');
    this.renderValue = this.renderValue.bind(this);
  }
  renderValue() {
    const {children, value} = this.props;
    if (children) {
      return children;
    }
    return value
  }
  render() {
    const {
      name,
      value,
      tabbed,
      tabIcon,
      onChange,
      className,
      selectedValue,
    } = this.props;
    const isChecked = value === selectedValue;
    return (
      <span className={[s.child, className].join(' ')}>
        <input id={this.id}
               type="radio"
               className={tabbed ? s.tab : s.radio}
               checked={isChecked}
               name={name}
               value={value}
               onChange={() => this.props.onChange(this.props.value)} />
        <label htmlFor={this.id}
               className={tabbed ? s.tabLabel : s.radioLabel}>
          {tabbed ?
            <span>
              <Icon className={s.tabIcon} name={tabIcon}/>
              {value}
            </span>
            :
            this.renderValue()
          }
        </label>
      </span>
    );
  }
}

Radio.propTypes = {
  name: PropTypes.string.isRequired,
  onChange: PropTypes.func.isRequired,

  // The value of the parent group
  selectedValue: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
  ]),

  // The value of this radio
  value: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
  ]),
  className: PropTypes.string,
  children: PropTypes.any,
{'fraction_non_alphanumeric': 0.1318407960199005, 'fraction_numerical': 0.0, 'mean_word_length': 1.9568014705882353, 'pattern_counts': {'":': 0, '<': 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': '4798345', 'n_tokens_mistral': 944, 'n_tokens_neox': 960, 'n_words': 208}