file-view-image.tsx 528 B

1234567891011121314151617181920212223
  1. import { useProjectContext } from '../../../shared/context/project-context'
  2. import { BinaryFile } from '@/features/file-view/types/binary-file'
  3. import { fileUrl } from '../../utils/fileUrl'
  4. export default function FileViewImage({
  5. file,
  6. onLoad,
  7. onError,
  8. }: {
  9. file: BinaryFile
  10. onLoad: () => void
  11. onError: () => void
  12. }) {
  13. const { projectId } = useProjectContext()
  14. return (
  15. <img
  16. src={fileUrl(projectId, file.id, file.hash)}
  17. onLoad={onLoad}
  18. onError={onError}
  19. alt={file.name}
  20. />
  21. )
  22. }