Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/components/Elements/FreeConsultation/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ interface FreeConsultationCardProps {

export default class FreeConsultationCard extends React.PureComponent<FreeConsultationCardProps, {}>
{

formatTels(contacts: Array<{ tel: string}>): string {
return contacts.map(contact => contact.tel).filter(tel => tel).join(", ")
}

render()
{
const { data } = this.props;
Expand All @@ -31,8 +36,8 @@ export default class FreeConsultationCard extends React.PureComponent<FreeConsul
<Button type='link' href={data.url} target='_blank'>{Message('VIEW_OFFICIAL_INFO')}</Button>
</div>
{data.contacts[0] && data.contacts[0].tel ? <div className={styles.infoItem}>
<Icon type="mobile" />
<div className={styles.phone}>{data.contacts.length > 0 ? data.contacts[0].tel : ""}</div>
<Icon type="phone" />
<div className={styles.phone}>{data.contacts.length > 0 ? this.formatTels(data.contacts as Array<{ tel: string}>) : ""}</div>
{isMobile ? <Button type='link' href={`tel:${data.contacts[0].tel}`}>{Message('DIAL_PHONE')}</Button> : null}
</div> : null}
</section>
Expand Down
24 changes: 16 additions & 8 deletions src/components/Elements/TravelHotel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class TravelHotelCard extends React.PureComponent<TravelHotelProp
<Row style={{ marginBottom: '10px'}} className={styles.lineInfo + ' ' + styles.greyFont}>
{travelhotel.city ?
<div style={{ marginRight: '20px' }}>
{travelhotel.city.split('-').map((el) => <span>{el}</span>)}
{travelhotel.city.split('-').map((el) => <span >{el}</span>)}
</div>
: null}
{
Expand All @@ -45,20 +45,28 @@ export default class TravelHotelCard extends React.PureComponent<TravelHotelProp
</Row>
<Row type='flex' style={{ fontSize: '16px', marginBottom: '10px' }}>
<div className={styles.addressWrapper}>
<Icon type="bank" style={{ marginRight: '19px' }} />
<Icon type="bank" style={{ marginRight: '10px' }} />
<span style={{ marginRight: '10px' }}>{travelhotel.address}</span>
</div>
<Button type='link' className={styles.viewMap} onClick={() => this.onViewMap(travelhotel.address || '')}>{Message('VIEW_MAP')}</Button>
</Row>
{
travelhotel.contacts ?
<Row style={{ fontSize: '16px' }}>
<Icon type="phone" style={{ marginRight: '19px' }} />
{travelhotel.contacts[0].name ? (
<span style={{ marginRight: '10px' }}>{travelhotel.contacts[0].name}</span>
) : null}
{!isMobile ? <span>{travelhotel.contacts[0].tel}</span> : null}
{isMobile ? <Button type='link' href={`tel:${travelhotel.contacts[0].tel}`}>{travelhotel.contacts[0].tel}</Button> : null}
<Icon type="phone" style={{ marginRight: '10px' }} />
{
travelhotel.contacts.filter(contact => contact.name).map((contact, index) => {
return (
<span key={`travel_hotel_contact_name_${index}`} style={{ marginRight: index !== 0 ? '0' : '10px' }}>{contact.name}</span>
)
})
}
{
travelhotel.contacts.filter(contact => contact.tel).map((contact, index) => {
return isMobile ? <span style={{ marginRight: index !== 0 ? '0' : '10px' }} key={`travel_hotel_contact_tel_${index}_mobile`}>{contact.tel}</span> : <Button key={`travel_hotel_contact_tel_${index}_no_mobile`} style={{ marginRight: index !== 0 ? '0' : '10px' }} type='link' href={`tel:${contact.tel}`}>{contact.tel}</Button>
})
}

</Row>
: null
}
Expand Down