mirror of
https://github.com/strapi/strapi.git
synced 2025-08-13 03:07:32 +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 isFile = getType(type) === 'file';
|
||||
|
||||
const renderFile = () => <FileIcon fileType={type} />;
|
||||
|
||||
const renderImage = () => <Image src={url} />;
|
||||
if (hasError) {
|
||||
return (
|
||||
<Wrapper isFile>
|
||||
<BrokenFile />
|
||||
</Wrapper>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Wrapper isFile={isFile || hasError}>
|
||||
{!hasError && isFile && renderFile()}
|
||||
{!hasError && !isFile && renderImage()}
|
||||
{hasError && <BrokenFile />}
|
||||
</Wrapper>
|
||||
<Wrapper isFile={isFile}>{isFile ? <FileIcon fileType={type} /> : <Image src={url} />}</Wrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user