2020-03-02 00:21:43 +01:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import FileIcon from '../FileIcon';
|
|
|
|
import Wrapper from './Wrapper';
|
|
|
|
import Image from './Image';
|
|
|
|
|
|
|
|
const CardPreview = ({ url, type }) => {
|
2020-03-06 17:19:20 +01:00
|
|
|
const isFile = !type.includes('image') && !type.includes('video');
|
|
|
|
|
2020-03-05 16:13:44 +01:00
|
|
|
return (
|
2020-03-06 17:19:20 +01:00
|
|
|
<Wrapper isFile={isFile}>{isFile ? <FileIcon fileType={type} /> : <Image src={url} />}</Wrapper>
|
2020-03-05 16:13:44 +01:00
|
|
|
);
|
2020-03-02 00:21:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
CardPreview.defaultProps = {
|
|
|
|
url: null,
|
2020-03-06 17:19:20 +01:00
|
|
|
type: '',
|
2020-03-02 00:21:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
CardPreview.propTypes = {
|
|
|
|
url: PropTypes.string,
|
|
|
|
type: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default CardPreview;
|