mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
7c97f8ab6e
* Use new JSX runtime and update Babel Node target * Update .eslintrc * Remove React imports GitOrigin-RevId: 559de0267f8f2934c56a860ea8701bb522aa861a
25 lines
643 B
JavaScript
25 lines
643 B
JavaScript
import PropTypes from 'prop-types'
|
|
import { useEditorContext } from '../../../shared/context/editor-context'
|
|
|
|
export default function FileViewImage({ fileName, fileId, onLoad, onError }) {
|
|
const { projectId } = useEditorContext({
|
|
projectId: PropTypes.string.isRequired,
|
|
})
|
|
|
|
return (
|
|
<img
|
|
src={`/project/${projectId}/file/${fileId}`}
|
|
onLoad={onLoad}
|
|
onError={onError}
|
|
onAbort={onError}
|
|
alt={fileName}
|
|
/>
|
|
)
|
|
}
|
|
|
|
FileViewImage.propTypes = {
|
|
fileName: PropTypes.string.isRequired,
|
|
fileId: PropTypes.string.isRequired,
|
|
onLoad: PropTypes.func.isRequired,
|
|
onError: PropTypes.func.isRequired,
|
|
}
|