function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React from 'react';
import PropTypes from 'prop-types';
import GridList from '../../../organism/grid-list';
import BrandCard from '../../../molecule/brand-card';
import BrandCardCreate from '../../../molecule/brand-card-create';
import Search from '../../../atom/input-search';
import Select from '../../../molecule/select-multiple';
import RadioGroup from '../../../atom/radio-group';
import Layout from '../layout';
import Loader from '../../../atom/loader';
import style from './style.css';
const BrandList = Layout(props => {
  const {
    brands = [],
    create,
    search: {
      select,
      ...search
    } = {},
    filter,
    isLoading
  } = props;
  const brandCards = brands.map((brand, index) => {
    return /*#__PURE__*/React.createElement("div", {
      key: brand.title,
      className: style.brand
    }, /*#__PURE__*/React.createElement(BrandCard, brand));
  });
  if (create) {
    brandCards.push(/*#__PURE__*/React.createElement("div", {
      key: "new",
      className: style.brand
    }, /*#__PURE__*/React.createElement(BrandCardCreate, create)));
  }
  return /*#__PURE__*/React.createElement("div", {
    className: style.container
  }, filter ? /*#__PURE__*/React.createElement("div", {
    className: style.filterBar
  }, /*#__PURE__*/React.createElement(RadioGroup, filter)) : null, /*#__PURE__*/React.createElement("div", {
    className: style.filters
  }, /*#__PURE__*/React.createElement("div", {
    className: style.searchBar
  }, /*#__PURE__*/React.createElement(Search, _extends({}, search, {
    theme: "coorpmanager"
  }))), select ? /*#__PURE__*/React.createElement("div", {
    className: style.provider
  }, /*#__PURE__*/React.createElement(Select, _extends({}, select, {
    theme: "coorpmanager"
  }))) : null), isLoading ? /*#__PURE__*/React.createElement("div", {
    className: style.loader
  }, /*#__PURE__*/React.createElement(Loader, {
    theme: "coorpmanager"
  })) : /*#__PURE__*/React.createElement("div", {
    className: style.wrapper
  }, /*#__PURE__*/React.createElement(GridList, null, brandCards)));
});
BrandList.propTypes = process.env.NODE_ENV !== "production" ? {
  brands: PropTypes.arrayOf(PropTypes.shape(BrandCard.propTypes)),
  filter: PropTypes.shape(RadioGroup.propTypes),
  search: PropTypes.shape(Search.propTypes),
  create: PropTypes.shape(BrandCardCreate.propTypes),
  isLoading: PropTypes.bool
} : {};
export default BrandList;
//# sourceMappingURL=index.js.map