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