import React from 'react'; import PropTypes from 'prop-types'; import { getExtension, getType } from '../../utils'; import BrokenFile from '../../icons/BrokenFile'; import FileIcon from '../FileIcon'; import Wrapper from './Wrapper'; import Image from './Image'; const CardPreview = ({ hasError, url, type }) => { const isFile = getType(type) === 'file'; if (hasError) { return ( ); } return ( {isFile ? : } ); }; CardPreview.defaultProps = { hasError: false, url: null, type: '', }; CardPreview.propTypes = { hasError: PropTypes.bool, url: PropTypes.string, type: PropTypes.string, }; export default CardPreview;