docbrown/app/javascript/listings/components/AllListings.jsx
Katie Davis 76453b41fb
Updates ESLint rules to error on default imports (#12512)
* add rule

* add named imports

* more missed files

* so many files
2021-02-02 10:24:03 -05:00

47 lines
1.2 KiB
JavaScript

import { h } from 'preact';
import PropTypes from 'prop-types';
import { SingleListing } from '../singleListing/SingleListing';
import { NextPageButton } from './NextPageButton';
export const AllListings = ({
listings,
onAddTag,
onChangeCategory,
currentUserId,
onOpenModal,
showNextPageButton,
loadNextPage,
}) => {
return (
<main class="crayons-layout__content">
<div className="listings-columns" id="listings-results">
{listings.map((listing) => (
<SingleListing
onAddTag={onAddTag}
onChangeCategory={onChangeCategory}
listing={listing}
currentUserId={currentUserId}
onOpenModal={onOpenModal}
isOpen={false}
/>
))}
</div>
{showNextPageButton && <NextPageButton onClick={loadNextPage} />}
</main>
);
};
AllListings.propTypes = {
currentUserId: PropTypes.number,
listings: PropTypes.isRequired,
onAddTag: PropTypes.func.isRequired,
onChangeCategory: PropTypes.func.isRequired,
onOpenModal: PropTypes.func.isRequired,
showNextPageButton: PropTypes.bool.isRequired,
loadNextPage: PropTypes.func.isRequired,
};
AllListings.defaultProps = {
currentUserId: null,
};