mirror of
https://github.com/strapi/strapi.git
synced 2025-08-13 19:27:34 +00:00
card preview statement
Signed-off-by: Virginie Ky <virginie.ky@gmail.com>
This commit is contained in:
parent
1a695b7da9
commit
cfe0ddbff8
@ -11,16 +11,16 @@ import Image from './Image';
|
|||||||
const CardPreview = ({ hasError, url, type }) => {
|
const CardPreview = ({ hasError, url, type }) => {
|
||||||
const isFile = getType(type) === 'file';
|
const isFile = getType(type) === 'file';
|
||||||
|
|
||||||
const renderFile = () => <FileIcon fileType={type} />;
|
if (hasError) {
|
||||||
|
return (
|
||||||
const renderImage = () => <Image src={url} />;
|
<Wrapper isFile>
|
||||||
|
<BrokenFile />
|
||||||
|
</Wrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper isFile={isFile || hasError}>
|
<Wrapper isFile={isFile}>{isFile ? <FileIcon fileType={type} /> : <Image src={url} />}</Wrapper>
|
||||||
{!hasError && isFile && renderFile()}
|
|
||||||
{!hasError && !isFile && renderImage()}
|
|
||||||
{hasError && <BrokenFile />}
|
|
||||||
</Wrapper>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user