overleaf/services/web/frontend/js/features/file-view/components/file-view-image.tsx
Alf Eaton 0cde5be165 Merge pull request #14709 from overleaf/ae-context-typescript
Convert React context providers to TypeScript [don't squash!]

GitOrigin-RevId: d92a91798286978410956ab791d73c17c5086d86
2024-01-29 09:03:04 +00:00

24 lines
450 B
TypeScript

import { useProjectContext } from '../../../shared/context/project-context'
export default function FileViewImage({
fileName,
fileId,
onLoad,
onError,
}: {
fileName: string
fileId: string
onLoad: () => void
onError: () => void
}) {
const { _id: projectId } = useProjectContext()
return (
<img
src={`/project/${projectId}/file/${fileId}`}
onLoad={onLoad}
onError={onError}
alt={fileName}
/>
)
}