2022-04-14 22:12:30 +08:00
|
|
|
<script lang="ts">
|
|
|
|
import { createEventDispatcher } from "svelte";
|
2022-07-22 02:12:46 +08:00
|
|
|
import { BlockLabel } from "@gradio/atoms";
|
2022-04-14 22:12:30 +08:00
|
|
|
|
2022-05-10 08:26:09 +08:00
|
|
|
import { Image } from "@gradio/icons";
|
2022-04-14 22:12:30 +08:00
|
|
|
|
|
|
|
export let value: null | string;
|
|
|
|
export let label: string | undefined = undefined;
|
2022-04-27 18:47:15 +08:00
|
|
|
export let show_label: boolean;
|
2022-04-14 22:12:30 +08:00
|
|
|
|
|
|
|
const dispatch = createEventDispatcher<{
|
|
|
|
change: string;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
$: value && dispatch("change", value);
|
|
|
|
</script>
|
|
|
|
|
2022-05-10 08:26:09 +08:00
|
|
|
<BlockLabel {show_label} Icon={Image} label={label || "Image"} />
|
2022-04-26 22:48:39 +08:00
|
|
|
{#if value === null}
|
2022-05-16 01:44:15 +08:00
|
|
|
<div class="h-full min-h-[15rem] flex justify-center items-center">
|
2022-05-13 01:47:40 +08:00
|
|
|
<div class="h-5 dark:text-white opacity-50"><Image /></div>
|
2022-04-26 22:48:39 +08:00
|
|
|
</div>
|
|
|
|
{:else}
|
2022-05-12 12:40:41 +08:00
|
|
|
<img class="w-full h-full object-contain" src={value} alt="" />
|
2022-04-26 22:48:39 +08:00
|
|
|
{/if}
|