// Copyright 2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; import classNames from 'classnames'; import { unescape } from 'lodash'; import type { LinkPreviewType } from '../types/message/LinkPreviews'; import type { LocalizerType } from '../types/Util'; import { CurveType, Image } from './conversation/Image'; import { isImageAttachment } from '../types/Attachment'; import { getDomain } from '../types/LinkPreview'; export type Props = LinkPreviewType & { forceCompactMode?: boolean; i18n: LocalizerType; }; export function StoryLinkPreview({ description, domain, forceCompactMode, i18n, image, title, url, }: Props): JSX.Element { const isImage = isImageAttachment(image); const location = domain || getDomain(String(url)); const isCompact = forceCompactMode || !image; let content: JSX.Element | undefined; if (!title && !description) { content = (