'use strict';

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

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _dec, _class, _class2, _temp2;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _reactImmutableProptypes = require('react-immutable-proptypes');

var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes);

var _lib = require('@instructure/ui-themeable/lib');

var _lib2 = _interopRequireDefault(_lib);

var _Card = require('../../../common/components/shared/Card');

var _Card2 = _interopRequireDefault(_Card);

var _BankEntryRow = require('../BankEntryRow');

var _BankEntryRow2 = _interopRequireDefault(_BankEntryRow);

var _theme = require('./theme');

var _theme2 = _interopRequireDefault(_theme);

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

var styles = {
  template: function template(theme) {
    return '/*  imported from styles.css  */\n\n.BankEntriesList__styles__entryRow {\n  margin-bottom: ' + theme.entryRowMargin + ';\n}\n';
  },
  'entryRow': 'BankEntriesList__styles__entryRow'
};
var BankEntriesList = (_dec = (0, _lib2.default)(_theme2.default, styles), _dec(_class = (_temp2 = _class2 = function (_Component) {
  (0, _inherits3.default)(BankEntriesList, _Component);

  function BankEntriesList() {
    var _ref;

    var _temp, _this, _ret;

    (0, _classCallCheck3.default)(this, BankEntriesList);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = BankEntriesList.__proto__ || Object.getPrototypeOf(BankEntriesList)).call.apply(_ref, [this].concat(args))), _this), _this.renderEntry = function (entry) {
      var entryId = entry.get('id');

      return _react2.default.createElement(
        _Card2.default,
        { key: entryId, className: styles.entryRow },
        _react2.default.createElement(_BankEntryRow2.default, {
          bankEntry: entry,
          bankId: _this.props.bankId,
          navigateToBankEntry: _this.props.navigateToBankEntry,
          addEntryToQuiz: _this.props.addEntryToQuiz
        })
      );
    }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
  }

  (0, _createClass3.default)(BankEntriesList, [{
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        'div',
        null,
        this.props.bankEntries.toArray().map(this.renderEntry)
      );
    }
  }]);
  BankEntriesList.displayName = 'BankEntriesList'
  ;
  return BankEntriesList;
}(_react.Component), _class2.propTypes = {
  addEntryToQuiz: _propTypes2.default.func,
  bankId: _propTypes2.default.string.isRequired,
  bankEntries: _reactImmutableProptypes2.default.list.isRequired,
  navigateToBankEntry: _propTypes2.default.func.isRequired
}, _class2.defaultProps = {
  addEntryToQuiz: null
}, _temp2)) || _class);
exports.default = BankEntriesList;