"use strict";

var _react = _interopRequireDefault(require("react"));

var _react2 = require("@storybook/react");

var _index = require("../index");

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

var TABLE_HEADERS = [{
  title: 'age',
  keyToSort: 'age',
  asc: true,
  isSorted: true,
  isSortable: true
}, {
  title: 'sex',
  keyToSort: 'sex',
  asc: false,
  isSortable: true
}, {
  title: 'location',
  keyToSort: 'location',
  asc: false,
  isSortable: true
}];
var list = [{
  age: 20,
  sex: 'M',
  location: 'south africa'
}, {
  age: 22,
  sex: 'F',
  location: 'south america'
}];

var TableComponent = function TableComponent(_ref) {
  var list = _ref.list;
  return list.map(function (exchange) {
    var age = exchange.age,
        sex = exchange.sex,
        location = exchange.location;
    return _react.default.createElement(_index.Row, {
      key: age
    }, _react.default.createElement(_index.Cell, {
      title: age
    }), _react.default.createElement(_index.Cell, {
      title: sex
    }), _react.default.createElement(_index.Cell, {
      title: location
    }));
  });
};

var TableHOC = (0, _index.tableHOC)(TableComponent);
(0, _react2.storiesOf)('Web|Table', module).add('hoc', function () {
  return _react.default.createElement(TableHOC, {
    tableHeaders: TABLE_HEADERS,
    list: list
  });
});