<commit_before>const React = require('react');
const Radium = require('radium');

const Button = require('./Button');

const StyleConstants = require('../constants/Style');

const ButtonGroup = React.createClass({
  propTypes: {
    buttons: React.PropTypes.arrayOf(React.PropTypes.shape({
      icon: React.PropTypes.string,
      text: React.PropTypes.string
    }).isRequired),
    controlArrows: React.PropTypes.bool,
    primaryColor: React.PropTypes.string,
    type: React.PropTypes.oneOf([
      'base',
      'disabled',
      'neutral',
      'primary',
      'primaryOutline'
    ])
  },

  getDefaultProps () {
    return {
      buttons: [],
      controlArrows: false,
      primaryColor: StyleConstants.Colors.PRIMARY,
      type: 'primaryOutline'
    };
  },

  _getArrows () {
    this.props.buttons.unshift({ icon: 'caret-left' });
    this.props.buttons.push({ icon: 'caret-right' });
  },

  render () {
    const styles = this.styles();
    const buttonType = this.props.type;

    return (
      <div {...this.props}>
        {this.props.controlArrows ? this._getArrows() : null}
        {this.props.buttons.map(function (button, index, arr) {
          const isFirstChild = index === 0;
          const isLastChild = index === arr.length - 1;
          const isOnlyChild = isFirstChild && isLastChild;

          return (
            <Button
              icon={button.icon}
              key={index}
              style={[
                styles.component,
                styles[buttonType],
                isFirstChild && styles.firstChild,
                isLastChild && styles.lastChild,
                isOnlyChild && styles.onlyChild
              ]}
              type={buttonType}>
                {button.text}
            </Button>);
        })}
      </div>
    );
  },

  styles () {
    return {
      component: {
        borderRadius: 0,
        borderWidth: 1,
        borderRightWidth: 0
      },
      firstChild: {
        borderRadius: '2px 0 0 2px'
      },
      lastChild: {
        borderRadius: '0 2px 2px 0',
        borderRightWidth: 1
      },
      onlyChild: {
        borderRadius: 2,
        borderWidth: 1
      },
      base: {
        borderRight: '1px solid transparent',
        ':hover': {
          borderRadius: 2,
          borderRight: '1px solid initial'
        }
      }
    };
  }
});

module.exports = Radium(ButtonGroup);
<commit_msg>adds support for brand colors<commit_after>const React = require('react');
const Radium = require('radium');

const Button = require('./Button');

const StyleConstants = require('../constants/Style');

const ButtonGroup = React.createClass({
  propTypes: {
    buttons: React.PropTypes.arrayOf(React.PropTypes.shape({
      icon: React.PropTypes.string,
      text: React.PropTypes.string
    }).isRequired),
    controlArrows: React.PropTypes.bool,
    primaryColor: React.PropTypes.string,
    type: React.PropTypes.oneOf([
      'base',
      'disabled',
      'neutral',
      'primary',
      'primaryOutline'
    ])
  },

  getDefaultProps () {
    return {
      buttons: [],
      controlArrows: false,
      primaryColor: StyleConstants.Colors.PRIMARY,
      type: 'primaryOutline'
    };
  },

  _getArrows () {
    this.props.buttons.unshift({ icon: 'caret-left' });
    this.props.buttons.push({ icon: 'caret-right' });
  },

  render () {
    const styles = this.styles();
    const buttonType = this.props.type;
    const primaryColor = this.props.primaryColor;

    return (
      <div {...this.props}>
        {this.props.controlArrows ? this._getArrows() : null}
        {this.props.buttons.map(function (button, index, arr) {
          const isFirstChild = index === 0;
          const isLastChild = index === arr.length - 1;
          const isOnlyChild = isFirstChild && isLastChild;

          return (
            <Button
              icon={button.icon}
              key={index}
              primaryColor={primaryColor}
              style={[
                styles.component,
                styles[buttonType],
                isFirstChild && styles.firstChild,
                isLastChild && styles.lastChild,
                isOnlyChild && styles.onlyChild
              ]}
              type={buttonType}>
                {button.text}
            </Button>);
        })}
      </div>
    );
  },

  styles () {
    return {
      component: {
        borderRadius: 0,
        borderWidth: 1,
        borderRightWidth: 0
      },
      firstChild: {
        borderRadius: '2px 0 0 2px'
      },
      lastChild: {
        borderRadius: '0 2px 2px 0',
        borderRightWidth: 1
      },
      onlyChild: {
        borderRadius: 2,
        borderWidth: 1
      },
      base: {
        borderRight: '1px solid transparent',
        ':hover': {
          borderRadius: 2,
          borderRight: '1px solid initial'
        }
      }
    };
  }
});

module.exports = Radium(ButtonGroup);

{'fraction_non_alphanumeric': 0.12860625761885414, 'fraction_numerical': 0.0077204388459975615, 'mean_word_length': 1.845664739884393, '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': '1757610', 'n_tokens_mistral': 1471, 'n_tokens_neox': 1414, 'n_words': 286}