mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-16 00:33:27 +01:00
24 lines
556 B
TypeScript
24 lines
556 B
TypeScript
import { convertFileSrc } from '@tauri-apps/api/tauri';
|
|
import classNames from 'classnames';
|
|
import type { HttpResponse } from '../../lib/models';
|
|
|
|
interface Props {
|
|
response: HttpResponse;
|
|
className?: string;
|
|
}
|
|
|
|
export function ImageViewer({ response, className }: Props) {
|
|
if (response.bodyPath === null) {
|
|
return <div>Empty response body</div>;
|
|
}
|
|
|
|
const src = convertFileSrc(response.bodyPath);
|
|
return (
|
|
<img
|
|
src={src}
|
|
alt="Response preview"
|
|
className={classNames(className, 'max-w-full max-h-full')}
|
|
/>
|
|
);
|
|
}
|