import React, { PropTypes } from 'react';
import classNames from 'classnames';

function ClearAll({ onClick, label, theme }) {
  const clearAll = () => (
    onClick(true)
  );

  return (
    <span
      key="clearAll"
      className={
        classNames(
            'c-clear-all',
            'c-clear-all__pull-right',
            'c-clear-all__draggable-container',
            theme['c-clear-all'],
            theme['c-clear-all__pull-right'],
            theme['c-clear-all__draggable-container'],
          )
        }
      onClick={clearAll}
    >
      {label}
    </span>
  );
}

ClearAll.propTypes = {
  theme: PropTypes.oneOfType([
    PropTypes.object,
    PropTypes.func,
  ]).isRequired,
  onClick: PropTypes.func,
  label: PropTypes.string,
};

ClearAll.defaultProps = {
  onClick: null,
  label: 'Clear All',
  theme: {},
};

export default ClearAll;
