mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 13:06:03 +10:00
They are changed to use rootClassName for consistency and protection against future bundling order changes.
59 lines
1.7 KiB
JavaScript
59 lines
1.7 KiB
JavaScript
import React from 'react';
|
|
import { FormattedMessage } from 'react-intl';
|
|
import { InlineTextButton } from '../../components';
|
|
import { LINE_ITEM_NIGHT, LINE_ITEM_DAY } from '../../util/types';
|
|
import config from '../../config';
|
|
|
|
import css from './ListingPage.css';
|
|
|
|
const SectionHeading = props => {
|
|
const {
|
|
priceTitle,
|
|
formattedPrice,
|
|
richTitle,
|
|
category,
|
|
hostLink,
|
|
showContactUser,
|
|
onContactUser,
|
|
} = props;
|
|
|
|
const unitType = config.bookingUnitType;
|
|
const isNightly = unitType === LINE_ITEM_NIGHT;
|
|
const isDaily = unitType === LINE_ITEM_DAY;
|
|
|
|
const unitTranslationKey = isNightly
|
|
? 'ListingPage.perNight'
|
|
: isDaily
|
|
? 'ListingPage.perDay'
|
|
: 'ListingPage.perUnit';
|
|
|
|
return (
|
|
<div className={css.sectionHeading}>
|
|
<div className={css.desktopPriceContainer}>
|
|
<div className={css.desktopPriceValue} title={priceTitle}>
|
|
{formattedPrice}
|
|
</div>
|
|
<div className={css.desktopPerUnit}>
|
|
<FormattedMessage id={unitTranslationKey} />
|
|
</div>
|
|
</div>
|
|
<div className={css.heading}>
|
|
<h1 className={css.title}>{richTitle}</h1>
|
|
<div className={css.author}>
|
|
{category}
|
|
<FormattedMessage id="ListingPage.hostedBy" values={{ name: hostLink }} />
|
|
{showContactUser ? (
|
|
<span className={css.contactWrapper}>
|
|
<span className={css.separator}>•</span>
|
|
<InlineTextButton rootClassName={css.contactLink} onClick={onContactUser}>
|
|
<FormattedMessage id="ListingPage.contactUser" />
|
|
</InlineTextButton>
|
|
</span>
|
|
) : null}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default SectionHeading;
|