file-image-render.tsx 685 B

1234567891011121314151617181920212223242526272829303132
  1. import cn from '@/utils/classnames'
  2. type FileImageRenderProps = {
  3. imageUrl: string
  4. className?: string
  5. alt?: string
  6. onLoad?: () => void
  7. onError?: () => void
  8. showDownloadAction?: boolean
  9. }
  10. const FileImageRender = ({
  11. imageUrl,
  12. className,
  13. alt,
  14. onLoad,
  15. onError,
  16. showDownloadAction,
  17. }: FileImageRenderProps) => {
  18. return (
  19. <div className={cn('border-[2px] border-effects-image-frame shadow-xs', className)}>
  20. <img
  21. className={cn('w-full h-full object-cover', showDownloadAction && 'cursor-pointer')}
  22. alt={alt}
  23. onLoad={onLoad}
  24. onError={onError}
  25. src={imageUrl}
  26. />
  27. </div>
  28. )
  29. }
  30. export default FileImageRender