{"size": 937, "ext": "js", "max_stars_repo_path": "src/components/Label/RemoveButton.js", "max_stars_repo_name": "leoluk/patternfly-react", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/Label/RemoveButton.js", "max_issues_repo_name": "leoluk/patternfly-react", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/Label/RemoveButton.js", "max_forks_repo_name": "leoluk/patternfly-react", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.425, "max_line_length": 72, "alphanum_fraction": 0.636072572}
import ClassNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { noop } from '../../common/helpers';

const RemoveButton = ({ className, title, onRemoveClick, ...rest }) => {
  const classes = ClassNames('pficon pficon-close', className);

  return (
    <a
      href="#"
      onClick={e => {
        e.preventDefault();
        onRemoveClick && onRemoveClick();
      }}
      className="pf-remove-button"
    >
      <span className={classes} {...rest} aria-hidden="true" />
      <span className="sr-only">{title}</span>
    </a>
  );
};

RemoveButton.propTypes = {
  /** Additional css classes */
  className: PropTypes.string,
  /** Reader title text */
  title: PropTypes.string,
  /** Callback when remove button is clicked */
  onRemoveClick: PropTypes.func
};

RemoveButton.defaultProps = {
  className: '',
  title: 'Remove',
  onRemoveClick: noop
};

export default RemoveButton;
