mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
510e686b7b
GitOrigin-RevId: 9cd0b4429a9c2b3df9c18957aef21ef021e5fdfd
24 lines
621 B
JavaScript
24 lines
621 B
JavaScript
import PropTypes from 'prop-types'
|
|
import { useProjectContext } from '../../../shared/context/project-context'
|
|
|
|
export default function FileViewImage({ fileName, fileId, onLoad, onError }) {
|
|
const { _id: projectId } = useProjectContext({
|
|
_id: PropTypes.string.isRequired,
|
|
})
|
|
|
|
return (
|
|
<img
|
|
src={`/project/${projectId}/file/${fileId}`}
|
|
onLoad={onLoad}
|
|
onError={onError}
|
|
alt={fileName}
|
|
/>
|
|
)
|
|
}
|
|
|
|
FileViewImage.propTypes = {
|
|
fileName: PropTypes.string.isRequired,
|
|
fileId: PropTypes.string.isRequired,
|
|
onLoad: PropTypes.func.isRequired,
|
|
onError: PropTypes.func.isRequired,
|
|
}
|