// @flow
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import Classification, { getClassificationLabelColor } from '../classification';
import messages from './messages';
import type { item as ItemType } from './flowTypes';
type Props = {
isEmailLinkSectionExpanded: boolean,
item: ItemType,
showCollaboratorList: boolean,
};
function getTitle(isEmailLinkSectionExpanded, showCollaboratorList, item) {
const { name } = item;
let title;
if (isEmailLinkSectionExpanded) {
title = (
);
} else if (showCollaboratorList) {
title = (
);
} else {
title = (
);
}
return title;
}
const UnifiedShareModalTitle = ({ isEmailLinkSectionExpanded, showCollaboratorList, item }: Props) => {
const title = getTitle(isEmailLinkSectionExpanded, showCollaboratorList, item);
const { bannerPolicy, canUserSeeClassification, classification } = item;
const classificationColor = getClassificationLabelColor(bannerPolicy);
return (
<>
{title}
{canUserSeeClassification && (
)}
>
);
};
export default UnifiedShareModalTitle;