2024-02-23 02:49:34 +00:00
|
|
|
<script lang="ts">
|
2024-03-09 01:38:10 +00:00
|
|
|
import { WEBUI_BASE_URL } from '$lib/constants';
|
2024-02-23 02:49:34 +00:00
|
|
|
import ImagePreview from './ImagePreview.svelte';
|
|
|
|
|
|
|
|
export let src = '';
|
|
|
|
export let alt = '';
|
|
|
|
|
2024-08-05 16:00:04 +00:00
|
|
|
export let className = '';
|
2024-03-09 01:38:10 +00:00
|
|
|
|
2024-08-05 16:00:04 +00:00
|
|
|
let _src = '';
|
2024-03-09 01:38:10 +00:00
|
|
|
$: _src = src.startsWith('/') ? `${WEBUI_BASE_URL}${src}` : src;
|
|
|
|
|
2024-02-23 02:49:34 +00:00
|
|
|
let showImagePreview = false;
|
|
|
|
</script>
|
|
|
|
|
2024-08-05 16:00:04 +00:00
|
|
|
<div class={className}>
|
|
|
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
|
|
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
|
|
|
<img
|
2024-08-04 16:14:17 +00:00
|
|
|
on:click={() => {
|
|
|
|
showImagePreview = true;
|
|
|
|
}}
|
2024-08-05 16:00:04 +00:00
|
|
|
src={_src}
|
|
|
|
{alt}
|
2024-08-05 16:58:57 +00:00
|
|
|
class=" rounded-lg cursor-pointer"
|
2024-08-05 16:00:04 +00:00
|
|
|
draggable="false"
|
|
|
|
data-cy="image"
|
|
|
|
/>
|
2024-08-04 16:14:17 +00:00
|
|
|
</div>
|
2024-08-04 23:03:22 +00:00
|
|
|
<ImagePreview bind:show={showImagePreview} src={_src} {alt} />
|