2020-01-30 16:01:23 -05:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
import TruncatedText from 'component/common/truncated-text';
|
2022-02-25 06:04:23 -08:00
|
|
|
import { stripLeadingAtSign } from 'util/string';
|
2020-01-30 16:01:23 -05:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
claim: ?Claim,
|
|
|
|
title: string,
|
|
|
|
};
|
|
|
|
|
2020-01-30 17:25:15 -05:00
|
|
|
function ClaimPreviewTitle(props: Props) {
|
2020-01-30 16:01:23 -05:00
|
|
|
const { title, claim } = props;
|
2020-03-19 10:38:20 -04:00
|
|
|
|
2020-01-30 16:01:23 -05:00
|
|
|
return (
|
2020-01-30 17:25:15 -05:00
|
|
|
<div className="claim-preview__title">
|
2022-02-25 06:04:23 -08:00
|
|
|
{claim ? (
|
|
|
|
<TruncatedText text={title || stripLeadingAtSign(claim.name)} lines={2} />
|
|
|
|
) : (
|
|
|
|
<span>{__('Nothing here')}</span>
|
|
|
|
)}
|
2020-01-30 16:01:23 -05:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-01-30 17:25:15 -05:00
|
|
|
export default ClaimPreviewTitle;
|