"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf3 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

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

var _propTypes = _interopRequireDefault(require("prop-types"));

var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));

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

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

var _BankEntryRow = _interopRequireDefault(require("../BankEntryRow"));

var _theme = _interopRequireDefault(require("./theme"));

var _dec, _class, _class2, _temp;

var styles = {
  componentId: 'dibqR',
  template: function template(theme) {
    return "\n\n.dibqR_blfJ{margin-bottom:".concat(theme.entryRowMargin || 'inherit', "}");
  },
  'entryRow': 'dibqR_blfJ'
};
var BankEntriesList = (_dec = (0, _lib.default)(_theme.default, styles), _dec(_class = (_temp = _class2 =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(BankEntriesList, _Component);

  function BankEntriesList() {
    var _getPrototypeOf2;

    var _this;

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

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

    _this = (0, _possibleConstructorReturn2.default)(this, (_getPrototypeOf2 = (0, _getPrototypeOf3.default)(BankEntriesList)).call.apply(_getPrototypeOf2, [this].concat(args)));

    _this.renderEntry = function (entry) {
      var entryId = entry.get('id');
      return _react.default.createElement(_Card.default, {
        key: entryId,
        className: styles.entryRow
      }, _react.default.createElement(_BankEntryRow.default, {
        bankEntry: entry,
        bankId: _this.props.bankId,
        navigateToBankEntry: _this.props.navigateToBankEntry,
        addEntryToQuiz: _this.props.addEntryToQuiz
      }));
    };

    return _this;
  }

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