function MaybeSecondaryCardContent()

in newswires/client/src/WireItemList.tsx [103:152]


function MaybeSecondaryCardContent({
	headline,
	subhead,
	bodyText,
	highlight,
}: WireData['content'] & {
	highlight: string | undefined;
}): string | ReactNode | undefined {
	const theme = useEuiTheme();

	if (highlight && highlight.trim().length > 0) {
		return (
			<EuiText
				size="xs"
				css={css`
					margin-top: 0.1rem;
					padding: 0.1rem 0.5rem;
					background-color: ${theme.euiTheme.colors.highlight};
					justify-self: start;

					& mark {
						background-color: ${theme.euiTheme.colors.highlight};
						font-weight: bold;
						position: relative;
						border: 3px solid ${theme.euiTheme.colors.highlight};
					}
				`}
			>
				<p dangerouslySetInnerHTML={{ __html: sanitizeHtml(highlight) }} />
			</EuiText>
		);
	}
	if (subhead && subhead !== headline) {
		return <p>{subhead}</p>;
	}
	const maybeBodyTextPreview = bodyText
		? sanitizeHtml(bodyText, { allowedTags: [], allowedAttributes: {} }).slice(
				0,
				300,
			)
		: undefined;
	if (maybeBodyTextPreview && maybeBodyTextPreview !== headline) {
		return (
			<EuiTextBlockTruncate lines={2}>
				<p>{maybeBodyTextPreview}</p>
			</EuiTextBlockTruncate>
		);
	}
	return null;
}