2018-05-18 23:57:26 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import { Emojify } from './Emojify';
|
|
|
|
|
2018-05-22 19:31:43 +00:00
|
|
|
import { Localizer } from '../../types/Util';
|
|
|
|
|
2018-05-18 23:57:26 +00:00
|
|
|
interface Props {
|
|
|
|
phoneNumber: string;
|
|
|
|
name?: string;
|
|
|
|
profileName?: string;
|
2018-05-22 19:31:43 +00:00
|
|
|
i18n: Localizer;
|
2018-05-18 23:57:26 +00:00
|
|
|
}
|
|
|
|
|
2018-05-22 19:31:43 +00:00
|
|
|
export class ContactName extends React.Component<Props> {
|
2018-05-18 23:57:26 +00:00
|
|
|
public render() {
|
2018-05-22 19:31:43 +00:00
|
|
|
const { phoneNumber, name, profileName, i18n } = this.props;
|
2018-05-18 23:57:26 +00:00
|
|
|
|
|
|
|
const title = name ? name : phoneNumber;
|
|
|
|
const profileElement =
|
|
|
|
profileName && !name ? (
|
|
|
|
<span className="profile-name">
|
2018-05-22 19:31:43 +00:00
|
|
|
~<Emojify text={profileName} i18n={i18n} />
|
2018-05-18 23:57:26 +00:00
|
|
|
</span>
|
|
|
|
) : null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<span>
|
2018-05-22 19:31:43 +00:00
|
|
|
<Emojify text={title} i18n={i18n} /> {profileElement}
|
2018-05-18 23:57:26 +00:00
|
|
|
</span>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|