liquid-funding/app/components/image/ImageViewer.jsx

22 lines
563 B
React
Raw Normal View History

2019-02-02 19:56:08 +00:00
import React from 'react'
const docType = doc => {
const suffix = doc.name.split('.')
return suffix.slice(-1)[0]
}
export default ({ status }) => {
return (
<div>
{status && status.profileImg &&
<div>
{['jpg', 'gif', 'png'].includes(docType(status.profileImg)) &&
<img src={status.profileImg.img} alt='ipfs' style={{ maxWidth: '90%' }} />}
{docType(status.profileImg) === 'pdf' &&
<iframe src={status.profileImg.img} style={{ width: '100%', height: '90%' }}/>}
</div>
}
</div>
)
}