import React from 'react';
import PropTypes from 'prop-types';
import News from '../../news';
import Loader from '../../../atom/loader';
import style from './style.css';
const NewsList = /*#__PURE__*/React.memo(function NewsList(props) {
  const {
    title,
    news,
    more,
    loading = false
  } = props;
  const loadingView = /*#__PURE__*/React.createElement("div", {
    className: style.loader
  }, /*#__PURE__*/React.createElement(Loader, null));
  const moreView = more ?
  /*#__PURE__*/
  // eslint-disable-next-line react/jsx-handler-names
  React.createElement("div", {
    className: style.more,
    onClick: more.onClick
  }, more.label) : null;
  const cardsView = news.map((nws, key) => {
    return /*#__PURE__*/React.createElement("div", {
      className: style.card,
      key: key
    }, /*#__PURE__*/React.createElement(News, nws));
  });
  return /*#__PURE__*/React.createElement("div", {
    className: style.wrapper,
    "data-name": "news-list"
  }, /*#__PURE__*/React.createElement("div", {
    className: style.list
  }, /*#__PURE__*/React.createElement("div", {
    className: style.title
  }, title), cardsView, loading ? loadingView : moreView));
});
NewsList.propTypes = process.env.NODE_ENV !== "production" ? {
  title: PropTypes.string,
  news: PropTypes.arrayOf(PropTypes.shape(News.propTypes)),
  more: PropTypes.shape({
    label: PropTypes.string,
    onClick: PropTypes.func
  }),
  loading: PropTypes.bool
} : {};
export default NewsList;
//# sourceMappingURL=index.js.map