file-view-image.tsx 485 B

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