"test/vscode:/vscode.git/clone" did not exist on "5ba8cdf6aa77dc42469582a345783d89faed3608"
Image.svelte 699 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
	export let className = '';
Timothy J. Baek's avatar
Timothy J. Baek committed
9

Timothy J. Baek's avatar
Timothy J. Baek committed
10
	let _src = '';
Timothy J. Baek's avatar
Timothy J. Baek committed
11
12
	$: _src = src.startsWith('/') ? `${WEBUI_BASE_URL}${src}` : src;

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

Timothy J. Baek's avatar
Timothy J. Baek committed
16
17
18
19
<div class={className}>
	<!-- svelte-ignore a11y-click-events-have-key-events -->
	<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
	<img
Timothy J. Baek's avatar
Timothy J. Baek committed
20
21
22
		on:click={() => {
			showImagePreview = true;
		}}
Timothy J. Baek's avatar
Timothy J. Baek committed
23
24
		src={_src}
		{alt}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
25
		class=" rounded-lg cursor-pointer"
Timothy J. Baek's avatar
Timothy J. Baek committed
26
27
28
		draggable="false"
		data-cy="image"
	/>
Timothy J. Baek's avatar
Timothy J. Baek committed
29
</div>
Timothy J. Baek's avatar
revert  
Timothy J. Baek committed
30
<ImagePreview bind:show={showImagePreview} src={_src} {alt} />