Files
Signal-Desktop/ts/components/conversation/ContactName.tsx
2020-07-30 13:08:44 -07:00

34 lines
853 B
TypeScript

import React from 'react';
import { Emojify } from './Emojify';
export interface Props {
phoneNumber?: string;
name?: string;
profileName?: string;
module?: string;
}
export class ContactName extends React.Component<Props> {
public render() {
const { phoneNumber, name, profileName, module } = this.props;
const prefix = module ? module : 'module-contact-name';
const title = name ? name : phoneNumber;
const shouldShowProfile = Boolean(profileName && !name);
const profileElement = shouldShowProfile ? (
<span className={`${prefix}__profile-name`}>
~<Emojify text={profileName || ''} />
</span>
) : null;
return (
<span className={prefix} dir="auto">
<Emojify text={title || ''} />
{shouldShowProfile ? ' ' : null}
{profileElement}
</span>
);
}
}