docbrown/app/javascript/listings/singleListing/index.jsx
Michael Kohl 7f75f99560
[deploy] Rename classified listings (#7910)
* Change models and related files

* Update controllers and specs

* More renaming

* Seek and destroy, I mean search and replace

* Round up the stragglers

* Ground control to Major Travis...

* More fixes

* PR feedback

* Various fixes

* Rename view

* Fix list query builder

* Unify request specs

* Fix some API spec errors

* Fix remaining API specs

* Make spec conform to API

* Fix leftover problems

* Fix JS tests

* Fix column name in select

* Fix API specs

* Fix search specs

* Paging Mr. Travis
2020-05-27 13:35:09 +00:00

53 lines
1.4 KiB
JavaScript

import PropTypes from 'prop-types';
import { h } from 'preact';
import Header from './Header';
import TagLinks from './TagLinks';
import AuthorInfo from './AuthorInfo';
import listingPropTypes from './listingPropTypes';
const SingleListing = ({
listing,
currentUserId,
onAddTag,
onChangeCategory,
onOpenModal,
isOpen,
}) => {
const definedClass = isOpen
? 'single-listing single-listing--opened'
: 'single-listing';
return (
<div className={definedClass} id={`single-listing-${listing.id}`}>
<div className="listing-content">
<Header
listing={listing}
currentUserId={currentUserId}
onTitleClick={onOpenModal}
/>
<div
className="single-listing-body"
dangerouslySetInnerHTML={{ __html: listing.processed_html }} // eslint-disable-line react/no-danger
/>
<TagLinks tags={listing.tags} onClick={onAddTag} />
<AuthorInfo listing={listing} onCategoryClick={onChangeCategory} />
</div>
</div>
);
};
SingleListing.propTypes = {
listing: listingPropTypes.isRequired,
onAddTag: PropTypes.func.isRequired,
onOpenModal: PropTypes.func.isRequired,
onChangeCategory: PropTypes.func.isRequired,
isOpen: PropTypes.bool.isRequired,
currentUserId: PropTypes.number,
};
SingleListing.defaultProps = {
currentUserId: null,
};
export default SingleListing;