diff --git a/client/src/components/AssetPreview/index.jsx b/client/src/components/AssetPreview/index.jsx index 6bfd5e68..4da63eb1 100644 --- a/client/src/components/AssetPreview/index.jsx +++ b/client/src/components/AssetPreview/index.jsx @@ -3,46 +3,42 @@ import { Link } from 'react-router-dom'; import createCanonicalLink from '../../../../utils/createCanonicalLink'; const AssetPreview = ({ defaultThumbnail, claimData }) => { - const { name, fileExt, contentType, thumbnail, title } = claimData; - const showUrl = createCanonicalLink({ asset: { ...claimData }}); + const {name, fileExt, contentType, thumbnail, title} = claimData; + const showUrl = createCanonicalLink({asset: {...claimData}}); const embedUrl = `${showUrl}.${fileExt}`; - return ( - - {(() => { - switch (contentType) { - case 'image/jpeg': - case 'image/jpg': - case 'image/png': - case 'image/gif': - return ( -
- {name} -

{title}

-
- ); - case 'video/mp4': - return ( -
- {name} -

{title}

-
- ); - default: - return ( -

unsupported file type

- ); - } - })()} - - ); + switch (contentType) { + case 'image/jpeg': + case 'image/jpg': + case 'image/png': + case 'image/gif': + return ( + +
+ {name} +

{title}

+
+ + ); + case 'video/mp4': + return ( + +
+ {name} +

{title}

+
+ + ); + default: + return null; + } }; export default AssetPreview;