gradio-pr-bot commited on
Commit
0a7a540
·
verified ·
1 Parent(s): 339de61

Upload folder using huggingface_hub

Browse files
6.2.0/image/shared/ImagePreview.svelte CHANGED
@@ -22,7 +22,7 @@
22
  export let value: null | FileData;
23
  export let label: string | undefined = undefined;
24
  export let show_label: boolean;
25
- export let buttons: (string | CustomButtonType)[] | null = null;
26
  export let on_custom_button_click: ((id: number) => void) | null = null;
27
  export let selectable = false;
28
  export let i18n: I18nFormatter;
@@ -44,11 +44,6 @@
44
  };
45
 
46
  let image_container: HTMLElement;
47
-
48
- $: buttons_to_render =
49
- buttons && buttons.length > 0
50
- ? buttons
51
- : ["download", "share", "fullscreen"];
52
  </script>
53
 
54
  <BlockLabel
@@ -63,18 +58,18 @@
63
  <IconButtonWrapper
64
  display_top_corner={display_icon_button_wrapper_top_corner}
65
  show_background={show_button_background}
66
- buttons={buttons_to_render}
67
  {on_custom_button_click}
68
  >
69
- {#if buttons_to_render.some((btn) => typeof btn === "string" && btn === "fullscreen")}
70
  <FullscreenButton {fullscreen} on:fullscreen />
71
  {/if}
72
- {#if buttons_to_render.some((btn) => typeof btn === "string" && btn === "download")}
73
  <DownloadLink href={value.url} download={value.orig_name || "image"}>
74
  <IconButton Icon={Download} label={i18n("common.download")} />
75
  </DownloadLink>
76
  {/if}
77
- {#if buttons_to_render.some((btn) => typeof btn === "string" && btn === "share")}
78
  <ShareButton
79
  {i18n}
80
  on:share
 
22
  export let value: null | FileData;
23
  export let label: string | undefined = undefined;
24
  export let show_label: boolean;
25
+ export let buttons: (string | CustomButtonType)[] = [];
26
  export let on_custom_button_click: ((id: number) => void) | null = null;
27
  export let selectable = false;
28
  export let i18n: I18nFormatter;
 
44
  };
45
 
46
  let image_container: HTMLElement;
 
 
 
 
 
47
  </script>
48
 
49
  <BlockLabel
 
58
  <IconButtonWrapper
59
  display_top_corner={display_icon_button_wrapper_top_corner}
60
  show_background={show_button_background}
61
+ {buttons}
62
  {on_custom_button_click}
63
  >
64
+ {#if buttons.some((btn) => typeof btn === "string" && btn === "fullscreen")}
65
  <FullscreenButton {fullscreen} on:fullscreen />
66
  {/if}
67
+ {#if buttons.some((btn) => typeof btn === "string" && btn === "download")}
68
  <DownloadLink href={value.url} download={value.orig_name || "image"}>
69
  <IconButton Icon={Download} label={i18n("common.download")} />
70
  </DownloadLink>
71
  {/if}
72
+ {#if buttons.some((btn) => typeof btn === "string" && btn === "share")}
73
  <ShareButton
74
  {i18n}
75
  on:share