"backend/vscode:/vscode.git/clone" did not exist on "dc25f44d312d60020b354ab8ddc268e5d5e6441a"
Image.svelte 530 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
Timothy J. Baek committed
15
<ImagePreview bind:show={showImagePreview} src={_src} {alt} />
Timothy J. Baek's avatar
Timothy J. Baek committed
16
17
18
19
20
21
<button
	on:click={() => {
		console.log('image preview');
		showImagePreview = true;
	}}
>
Timothy J. Baek's avatar
Timothy J. Baek committed
22
	<img src={_src} {alt} class=" max-h-96 rounded-lg" draggable="false" />
Timothy J. Baek's avatar
Timothy J. Baek committed
23
</button>