* flare tag line height * . * dropdown fix + actions bar fix * actions bar on mob * . * css commented out * . * button fix * preload adjustments * tags * Fixed listings modal to make it semantic HTML via <dialog />. * Refactor an a11y fix. * Removed test that is no longer needed. * Added missing global function for test.. * Fixed broken <ListingFiltersCategories /> tests. * Refactor of mobile dropdown for listing categories. * Updated a TODO. * Made the clear query button a crayons Preact button. * padding * Fixed listings modal for accessiblilty. * Removed rspecs that are no longer valid. * We're no longer using the <dialog /> element, at least for now, so CSS changes aren't necessary. * Wasn't supposed to be committed. Co-authored-by: Nick Taylor <nick@dev.to> Co-authored-by: rhymes <rhymes@hey.com> Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import { h } from 'preact';
|
|
import listingPropTypes from './listingPropTypes';
|
|
import DropdownMenu from './DropdownMenu';
|
|
import TagLinks from './TagLinks';
|
|
|
|
const Header = ({ listing, currentUserId, onTitleClick, onAddTag }) => {
|
|
const { id, user_id: userId, category, slug, title } = listing;
|
|
return (
|
|
<header className="mb-3">
|
|
<h2 className="fs-2xl fw-bold lh-tight mb-1 pr-8">
|
|
<a
|
|
href={`/listings/${category}/${slug}`}
|
|
data-no-instant
|
|
className="crayons-link"
|
|
onClick={(e) => onTitleClick(e, listing)}
|
|
data-listing-id={id}
|
|
>
|
|
{title}
|
|
</a>
|
|
</h2>
|
|
|
|
<TagLinks tags={listing.tags} onClick={onAddTag} />
|
|
|
|
<DropdownMenu listing={listing} isOwner={currentUserId === userId} />
|
|
</header>
|
|
);
|
|
};
|
|
|
|
Header.propTypes = {
|
|
listing: listingPropTypes.isRequired,
|
|
onAddTag: PropTypes.func.isRequired,
|
|
currentUserId: PropTypes.number,
|
|
onTitleClick: PropTypes.func.isRequired,
|
|
};
|
|
|
|
Header.defaultProps = {
|
|
currentUserId: null,
|
|
};
|
|
|
|
export default Header;
|