mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-26 13:45:30 +03:00
added preview image for links in sharing and editing popovers
This commit is contained in:
parent
f9713b6970
commit
7be8088d79
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user