Upload folder using huggingface_hub
Browse files
6.3.0/downloadbutton/shared/DownloadButton.svelte
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { type FileData } from "@gradio/client";
|
| 3 |
import { BaseButton } from "@gradio/button";
|
|
|
|
| 4 |
|
| 5 |
let {
|
| 6 |
elem_id = "",
|
|
@@ -13,7 +14,8 @@
|
|
| 13 |
disabled = false,
|
| 14 |
scale = null,
|
| 15 |
min_width = undefined,
|
| 16 |
-
on_click
|
|
|
|
| 17 |
}: {
|
| 18 |
elem_id?: string;
|
| 19 |
elem_classes?: string[];
|
|
@@ -26,6 +28,7 @@
|
|
| 26 |
scale?: number | null;
|
| 27 |
min_width?: number | undefined;
|
| 28 |
on_click?: () => void;
|
|
|
|
| 29 |
} = $props();
|
| 30 |
|
| 31 |
function download_file(): void {
|
|
@@ -56,7 +59,7 @@
|
|
| 56 |
{elem_id}
|
| 57 |
{elem_classes}
|
| 58 |
{visible}
|
| 59 |
-
|
| 60 |
{scale}
|
| 61 |
{min_width}
|
| 62 |
{disabled}
|
|
@@ -64,7 +67,9 @@
|
|
| 64 |
{#if icon}
|
| 65 |
<img class="button-icon" src={icon.url} alt={`${value} icon`} />
|
| 66 |
{/if}
|
| 67 |
-
|
|
|
|
|
|
|
| 68 |
</BaseButton>
|
| 69 |
|
| 70 |
<style>
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { type FileData } from "@gradio/client";
|
| 3 |
import { BaseButton } from "@gradio/button";
|
| 4 |
+
import { type Snippet } from "svelte";
|
| 5 |
|
| 6 |
let {
|
| 7 |
elem_id = "",
|
|
|
|
| 14 |
disabled = false,
|
| 15 |
scale = null,
|
| 16 |
min_width = undefined,
|
| 17 |
+
on_click,
|
| 18 |
+
children
|
| 19 |
}: {
|
| 20 |
elem_id?: string;
|
| 21 |
elem_classes?: string[];
|
|
|
|
| 28 |
scale?: number | null;
|
| 29 |
min_width?: number | undefined;
|
| 30 |
on_click?: () => void;
|
| 31 |
+
children?: Snippet;
|
| 32 |
} = $props();
|
| 33 |
|
| 34 |
function download_file(): void {
|
|
|
|
| 59 |
{elem_id}
|
| 60 |
{elem_classes}
|
| 61 |
{visible}
|
| 62 |
+
onclick={download_file}
|
| 63 |
{scale}
|
| 64 |
{min_width}
|
| 65 |
{disabled}
|
|
|
|
| 67 |
{#if icon}
|
| 68 |
<img class="button-icon" src={icon.url} alt={`${value} icon`} />
|
| 69 |
{/if}
|
| 70 |
+
{#if children}
|
| 71 |
+
{@render children()}
|
| 72 |
+
{/if}
|
| 73 |
</BaseButton>
|
| 74 |
|
| 75 |
<style>
|