'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports.default = function (_ref, property) {
  var _ref$getSortingColumn = _ref.getSortingColumns;
  var getSortingColumns = _ref$getSortingColumn === undefined ? function () {} : _ref$getSortingColumn;
  var _ref$onSort = _ref.onSort;
  var onSort = _ref$onSort === undefined ? function () {} : _ref$onSort;

  var Sort = function Sort() {
    var columns = getSortingColumns();
    var index = columns.map(function (c) {
      return c.property;
    }).indexOf(property);
    var headerClass = '';

    if (index >= 0) {
      headerClass = 'sort-' + columns[index].sort;
    }

    return {
      className: headerClass,
      onClick: function onClick() {
        return onSort(property);
      }
    };
  };
  Sort.propTypes = {
    property: _react2.default.PropTypes.string.isRequired
  };

  return Sort;
};

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }