docbrown/app/javascript/listings/components/AllListings.jsx
Suzanne Aitchison 5abe88c69b
Add skip links to readinglist, podcasts, and listings (#12769)
* add skip link functionality to readinglist, listings and podcasts

* fix initscrolling reference to podcasts
2021-02-23 08:33:26 +00: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" id="main-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,
};