added preview image for links in sharing and editing popovers

This commit is contained in:
Martina 2022-01-18 14:32:49 -08:00
parent f9713b6970
commit 7be8088d79

View File

@ -26,7 +26,8 @@ const STYLES_PREVIEW = css`
export default function BlobObjectPreview({ file, css, placeholderRatio = 1, ...props }) {
const isImage = Validations.isPreviewableImage(file.type);
const url = Strings.getURLfromCID(file.cid);
const isLink = file.isLink;
let url = Strings.getURLfromCID(file.cid);
if (isImage) {
return (
@ -36,6 +37,15 @@ export default function BlobObjectPreview({ file, css, placeholderRatio = 1, ...
);
}
if (isLink && (file.linkImage || file.linkFavicon)) {
url = file.linkImage || file.linkFavicon;
return (
<div css={[STYLES_PREVIEW, css]} {...props}>
<img src={url} alt="Link preview" />
</div>
);
}
return (
<div css={[STYLES_PREVIEW, css]} {...props}>
<ObjectPlaceholder