import React from 'react';
import PropTypes from 'prop-types';
import Table from '../../molecule/table';
import Pagination from '../../molecule/pagination';
import Search from '../../atom/input-search';
import Loader from '../../atom/loader';
import style from './style.css';
const BrandTable = props => {
  const {
    pagination,
    search,
    rows = [],
    columns = [],
    editable,
    isPending,
    emptyValue,
    onRefresh,
    refreshLabel,
    headerTitle = ''
  } = props;
  const pendingView = /*#__PURE__*/React.createElement("div", {
    className: style.loading
  }, /*#__PURE__*/React.createElement(Loader, null));
  const tableView = rows.length > 0 ? /*#__PURE__*/React.createElement(Table, {
    rows: rows,
    columns: columns,
    editable: editable,
    headerTitle: headerTitle
  }) : /*#__PURE__*/React.createElement("div", {
    className: style.empty
  }, emptyValue);
  const paginationView = pagination ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Pagination, pagination)) : null;
  const searchView = search ? /*#__PURE__*/React.createElement("div", {
    className: style.searchWrapper
  }, /*#__PURE__*/React.createElement(Search, search)) : null;
  const refreshView = onRefresh ? /*#__PURE__*/React.createElement("div", {
    className: style.refresh,
    onClick: onRefresh
  }, "\uD83D\uDD04 ", refreshLabel) : null;
  return /*#__PURE__*/React.createElement("div", {
    className: style.wrapper
  }, /*#__PURE__*/React.createElement("div", {
    className: style.headerWrapper
  }, refreshView, searchView, paginationView), /*#__PURE__*/React.createElement("div", null, isPending ? pendingView : tableView), /*#__PURE__*/React.createElement("div", null));
};
BrandTable.propTypes = process.env.NODE_ENV !== "production" ? {
  search: PropTypes.shape(Search.propTypes),
  pagination: PropTypes.shape(Pagination.propTypes),
  emptyValue: PropTypes.string.isRequired,
  isPending: PropTypes.bool,
  editable: PropTypes.bool,
  rows: Table.propTypes.rows,
  columns: Table.propTypes.columns,
  onRefresh: PropTypes.func,
  refreshLabel: PropTypes.string,
  headerTitle: PropTypes.string
} : {};
export default BrandTable;
//# sourceMappingURL=index.js.map