file-view-image.tsx 450 B

123456789101112131415161718192021222324
  1. import { useProjectContext } from '../../../shared/context/project-context'
  2. export default function FileViewImage({
  3. fileName,
  4. fileId,
  5. onLoad,
  6. onError,
  7. }: {
  8. fileName: string
  9. fileId: string
  10. onLoad: () => void
  11. onError: () => void
  12. }) {
  13. const { _id: projectId } = useProjectContext()
  14. return (
  15. <img
  16. src={`/project/${projectId}/file/${fileId}`}
  17. onLoad={onLoad}
  18. onError={onError}
  19. alt={fileName}
  20. />
  21. )
  22. }