File size: 1,168 Bytes
fe03105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<script lang="ts">
	import JSON from "./shared/JSON.svelte";

	export let value: any;
	export let theme_mode: "system" | "light" | "dark" = "system";
	let show_indices = false;
	let label_height = 0;
	export let type: "gallery" | "table";
	export let selected = false;
</script>

<div
	class="container"
	class:table={type === "table"}
	class:gallery={type === "gallery"}
	class:selected
	class:border={value}
>
	{#if value}
		<JSON
			{value}
			open={true}
			{theme_mode}
			{show_indices}
			{label_height}
			interactive={false}
			show_copy_button={false}
		/>
	{/if}
</div>

<style>
	.container :global(img) {
		width: 100%;
		height: 100%;
	}

	.container.selected {
		border-color: var(--border-color-accent);
	}
	.border.table {
		border: 1px solid var(--border-color-primary);
	}

	.container.table {
		margin: 0 auto;
		border-radius: var(--radius-lg);
		overflow: hidden;
		width: 100%;
		height: 100%;
		max-width: var(--size-40);
		max-height: var(--size-20);
		object-fit: cover;
	}

	.container.gallery {
		width: 100%;
		max-width: 100%;
		object-fit: cover;
		max-width: var(--size-40);
		max-height: var(--size-20);
		overflow: hidden;
	}
</style>