<commit_before>/**
 * Icon Button
 */

import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import Link from 'react-router-dom/Link';
import Icon from '../Icon';
import css from './IconButton.css';
import Badge from '../Badge';

const IconButton = ({ icon, onClick, onMouseDown, title, type, ariaLabel, id, style, className, badgeCount, iconClassName, tabIndex, badgeColor, href, size, iconSize, ...rest }) => {
  let Element = 'button';

  let buttonProps = {
    icon,
    onClick,
    onMouseDown,
    title,
    type,
    id,
    style,
    tabIndex,
    ...rest,
    className: classNames(css.iconButton, { [css.hasBadge]: badgeCount }, css[size], className),
    'aria-label': ariaLabel,
  };

  /**
   * If button is a link
   */
  if (href) {
    buttonProps = Object.assign(buttonProps, { to: href, type: '' });
    Element = Link;
  }

  return (
    <Element {...buttonProps}>
      <Icon icon={icon} size={iconSize} iconClassName={iconClassName} />
      { badgeCount !== undefined && <Badge size="medium" color={badgeColor}>{badgeCount}</Badge> }
    </Element>
  );
};

IconButton.propTypes = {
  className: PropTypes.string,
  icon: PropTypes.string,
  href: PropTypes.string,
  type: PropTypes.string,
  iconClassName: PropTypes.string,
  onClick: PropTypes.func,
  onMouseDown: PropTypes.func,
  title: PropTypes.string,
  size: PropTypes.oneOf([
    'medium',
    'small',
  ]),
  iconSize: PropTypes.oneOf([
    'small',
    'medium',
  ]),
  badgeCount: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
  ]),
  badgeColor: PropTypes.string,
  ariaLabel: PropTypes.string,
  id: PropTypes.string,
  tabIndex: PropTypes.string,
  style: PropTypes.object,
};

IconButton.defaultProps = {
  badgeColor: 'primary',
  type: 'button',
  size: 'medium',
  iconSize: 'medium',
};

export default IconButton;<commit_msg>Changed badge color on IconButton<commit_after>/**
 * Icon Button
 */

import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import Link from 'react-router-dom/Link';
import Icon from '../Icon';
import css from './IconButton.css';
import Badge from '../Badge';

const IconButton = ({ icon, onClick, onMouseDown, title, type, ariaLabel, id, style, className, badgeCount, iconClassName, tabIndex, badgeColor, href, size, iconSize, ...rest }) => {
  let Element = 'button';

  let buttonProps = {
    icon,
    onClick,
    onMouseDown,
    title,
    type,
    id,
    style,
    tabIndex,
    ...rest,
    className: classNames(css.iconButton, { [css.hasBadge]: badgeCount }, css[size], className),
    'aria-label': ariaLabel,
  };

  /**
   * If button is a link
   */
  if (href) {
    buttonProps = Object.assign(buttonProps, { to: href, type: '' });
    Element = Link;
  }

  return (
    <Element {...buttonProps}>
      <Icon icon={icon} size={iconSize} iconClassName={iconClassName} />
      { badgeCount !== undefined && <Badge size="medium" color={badgeColor}>{badgeCount}</Badge> }
    </Element>
  );
};

IconButton.propTypes = {
  className: PropTypes.string,
  icon: PropTypes.string,
  href: PropTypes.string,
  type: PropTypes.string,
  iconClassName: PropTypes.string,
  onClick: PropTypes.func,
  onMouseDown: PropTypes.func,
  title: PropTypes.string,
  size: PropTypes.oneOf([
    'medium',
    'small',
  ]),
  iconSize: PropTypes.oneOf([
    'small',
    'medium',
  ]),
  badgeCount: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
  ]),
  badgeColor: PropTypes.string,
  ariaLabel: PropTypes.string,
  id: PropTypes.string,
  tabIndex: PropTypes.string,
  style: PropTypes.object,
};

IconButton.defaultProps = {
  badgeColor: 'default',
  type: 'button',
  size: 'medium',
  iconSize: 'medium',
};

export default IconButton;
{'fraction_non_alphanumeric': 0.15021008403361344, 'fraction_numerical': 0.0, 'mean_word_length': 3.5507765830346476, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '2617752', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1246, 'n_words': 303}