import { h } from 'preact'; import PropTypes from 'prop-types'; import { Header } from './Header'; import { AuthorInfo } from './AuthorInfo'; import { listingPropTypes } from './listingPropTypes'; export const SingleListing = ({ isOpen, ...props }) => { const listingContent = ({ listing, currentUserId, onChangeCategory, onOpenModal, onAddTag, isModal = false, }) => { return (
); }; const listingInline = (props) => { const { listing } = props; return (
{listingContent(props)}
); }; const listingModal = (props) => { const { listing } = props; return (
{listingContent(props)}
); }; return isOpen ? listingModal({ ...props, isModal: true, }) : listingInline({ ...props, isModal: false, }); }; SingleListing.propTypes = { listing: listingPropTypes.isRequired, onOpenModal: PropTypes.func.isRequired, onChangeCategory: PropTypes.func.isRequired, isOpen: PropTypes.bool.isRequired, currentUserId: PropTypes.number, onAddTag: PropTypes.func.isRequired, }; SingleListing.defaultProps = { currentUserId: null, }; SingleListing.displayName = 'SingleListing';