* 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
34 lines
849 B
JavaScript
34 lines
849 B
JavaScript
import PropTypes from 'prop-types';
|
|
import { h } from 'preact';
|
|
import listingPropTypes from './listingPropTypes';
|
|
import DropdownMenu from './DropdownMenu';
|
|
|
|
const Header = ({ listing, currentUserId, onTitleClick }) => {
|
|
const { id, user_id: userId, category, slug, title } = listing;
|
|
return (
|
|
<h3 className="single-listing-header">
|
|
<a
|
|
href={`/listings/${category}/${slug}`}
|
|
data-no-instant
|
|
onClick={(e) => onTitleClick(e, listing)}
|
|
data-listing-id={id}
|
|
>
|
|
{title}
|
|
</a>
|
|
|
|
<DropdownMenu listing={listing} isOwner={currentUserId === userId} />
|
|
</h3>
|
|
);
|
|
};
|
|
|
|
Header.propTypes = {
|
|
listing: listingPropTypes.isRequired,
|
|
currentUserId: PropTypes.number,
|
|
onTitleClick: PropTypes.func.isRequired,
|
|
};
|
|
|
|
Header.defaultProps = {
|
|
currentUserId: null,
|
|
};
|
|
|
|
export default Header;
|