import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; import IconButton from 'Components/Link/IconButton'; import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper'; import VirtualTableHeader from 'Components/Table/VirtualTableHeader'; import VirtualTableHeaderCell from 'Components/Table/VirtualTableHeaderCell'; import VirtualTableSelectAllHeaderCell from 'Components/Table/VirtualTableSelectAllHeaderCell'; import { icons } from 'Helpers/Props'; import BookIndexTableOptionsConnector from './BookIndexTableOptionsConnector'; import styles from './BookIndexHeader.css'; function BookIndexHeader(props) { const { columns, onTableOptionChange, allSelected, allUnselected, onSelectAllChange, isEditorActive, ...otherProps } = props; return ( { columns.map((column) => { const { name, label, isSortable, isVisible } = column; if (!isVisible) { return null; } if (name === 'select') { if (isEditorActive) { return ( ); } return null; } if (name === 'actions') { return ( ); } return ( {label} ); }) } ); } BookIndexHeader.propTypes = { columns: PropTypes.arrayOf(PropTypes.object).isRequired, onTableOptionChange: PropTypes.func.isRequired, allSelected: PropTypes.bool.isRequired, allUnselected: PropTypes.bool.isRequired, onSelectAllChange: PropTypes.func.isRequired, isEditorActive: PropTypes.bool.isRequired }; export default BookIndexHeader;