"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _news = _interopRequireDefault(require("../../news"));
var _loader = _interopRequireDefault(require("../../../atom/loader"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const NewsList = /*#__PURE__*/_react.default.memo(function NewsList(props) {
  const {
    title,
    news,
    more,
    loading = false
  } = props;
  const loadingView = /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.loader
  }, /*#__PURE__*/_react.default.createElement(_loader.default, null));
  const moreView = more ?
  /*#__PURE__*/
  // eslint-disable-next-line react/jsx-handler-names
  _react.default.createElement("div", {
    className: _style.default.more,
    onClick: more.onClick
  }, more.label) : null;
  const cardsView = news.map((nws, key) => {
    return /*#__PURE__*/_react.default.createElement("div", {
      className: _style.default.card,
      key: key
    }, /*#__PURE__*/_react.default.createElement(_news.default, nws));
  });
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.wrapper,
    "data-name": "news-list"
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.list
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.title
  }, title), cardsView, loading ? loadingView : moreView));
});
NewsList.propTypes = process.env.NODE_ENV !== "production" ? {
  title: _propTypes.default.string,
  news: _propTypes.default.arrayOf(_propTypes.default.shape(_news.default.propTypes)),
  more: _propTypes.default.shape({
    label: _propTypes.default.string,
    onClick: _propTypes.default.func
  }),
  loading: _propTypes.default.bool
} : {};
var _default = exports.default = NewsList;
//# sourceMappingURL=index.js.map