File size: 794 Bytes
5e914f7
 
 
 
 
 
ffd8d78
 
 
 
 
 
 
 
 
 
 
 
 
5e914f7
 
 
 
 
 
 
 
 
 
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
<script lang="ts">
	import Copy from "./Copy.svelte";
	import Download from "./Download.svelte";
	import { IconButtonWrapper } from "@gradio/atoms";
	import type { CustomButton as CustomButtonType } from "@gradio/utils";

	interface Props {
		value: string;
		language: string;
		buttons?: (string | CustomButtonType)[] | null;
		on_custom_button_click?: ((id: number) => void) | null;
	}

	let {
		value,
		language,
		buttons = null,
		on_custom_button_click = null
	}: Props = $props();
</script>

<IconButtonWrapper {buttons} {on_custom_button_click}>
	{#if buttons?.some((btn) => typeof btn === "string" && btn === "download")}
		<Download {value} {language} />
	{/if}
	{#if buttons?.some((btn) => typeof btn === "string" && btn === "copy")}
		<Copy {value} />
	{/if}
</IconButtonWrapper>