Image.svelte 555 Bytes
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
<script lang="ts">
Timothy J. Baek's avatar
Timothy J. Baek committed
2
	import { WEBUI_BASE_URL } from '$lib/constants';
Timothy J. Baek's avatar
Timothy J. Baek committed
3
4
5
6
7
	import ImagePreview from './ImagePreview.svelte';

	export let src = '';
	export let alt = '';

Timothy J. Baek's avatar
Timothy J. Baek committed
8
9
10
11
	let _src = '';

	$: _src = src.startsWith('/') ? `${WEBUI_BASE_URL}${src}` : src;

Timothy J. Baek's avatar
Timothy J. Baek committed
12
13
14
	let showImagePreview = false;
</script>

Timothy J. Baek's avatar
revert  
Timothy J. Baek committed
15
<div class="w-full py-3">
Timothy J. Baek's avatar
Timothy J. Baek committed
16
17
18
19
20
21
22
23
	<button
		on:click={() => {
			showImagePreview = true;
		}}
	>
		<img src={_src} {alt} class=" max-h-96 rounded-lg" draggable="false" data-cy="image" />
	</button>
</div>
Timothy J. Baek's avatar
revert  
Timothy J. Baek committed
24
25

<ImagePreview bind:show={showImagePreview} src={_src} {alt} />