machineuser commited on
Commit
25f62c2
1 Parent(s): f19010e

Sync widgets demo

Browse files
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetFooter/WidgetFooter.svelte CHANGED
@@ -2,7 +2,7 @@
2
  import IconCode from "../../..//Icons/IconCode.svelte";
3
  import IconMaximize from "../../..//Icons/IconMaximize.svelte";
4
 
5
- export let onClickMaximizeBtn: () => void;
6
  export let outputJson: string;
7
  export let isDisabled = false;
8
 
@@ -22,9 +22,13 @@
22
  JSON Output
23
  </button>
24
  {/if}
25
- <button class="ml-auto flex items-center" on:click|preventDefault={onClickMaximizeBtn}>
26
  <IconMaximize classNames="mr-1" />
27
- Maximize
 
 
 
 
28
  </button>
29
  </div>
30
  {#if outputJson && isOutputJsonVisible}
 
2
  import IconCode from "../../..//Icons/IconCode.svelte";
3
  import IconMaximize from "../../..//Icons/IconMaximize.svelte";
4
 
5
+ export let isMaximized = false;
6
  export let outputJson: string;
7
  export let isDisabled = false;
8
 
 
22
  JSON Output
23
  </button>
24
  {/if}
25
+ <button class="ml-auto flex items-center" on:click|preventDefault={() => (isMaximized = !isMaximized)}>
26
  <IconMaximize classNames="mr-1" />
27
+ {#if !isMaximized}
28
+ Maximize
29
+ {:else}
30
+ Minimize
31
+ {/if}
32
  </button>
33
  </div>
34
  {#if outputJson && isOutputJsonVisible}
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetWrapper/WidgetWrapper.svelte CHANGED
@@ -104,10 +104,6 @@
104
  }
105
  })();
106
  });
107
-
108
- function onClickMaximizeBtn() {
109
- isMaximized = !isMaximized;
110
- }
111
  </script>
112
 
113
  {#if isDisabled && !inputSamples.length}
@@ -120,7 +116,7 @@
120
  {!modelLoadInfo ? 'hidden' : ''}"
121
  >
122
  {#if isMaximized}
123
- <button class="absolute right-12 top-6" on:click={onClickMaximizeBtn}>
124
  <IconCross classNames="text-xl text-gray-500 hover:text-black" />
125
  </button>
126
  {/if}
@@ -150,6 +146,6 @@
150
  <WidgetModelLoading estimatedTime={modelLoading.estimatedTime} />
151
  {/if}
152
  <slot name="bottom" />
153
- <WidgetFooter {onClickMaximizeBtn} {outputJson} {isDisabled} />
154
  </div>
155
  {/if}
 
104
  }
105
  })();
106
  });
 
 
 
 
107
  </script>
108
 
109
  {#if isDisabled && !inputSamples.length}
 
116
  {!modelLoadInfo ? 'hidden' : ''}"
117
  >
118
  {#if isMaximized}
119
+ <button class="absolute right-12 top-6" on:click={() => (isMaximized = !isMaximized)}>
120
  <IconCross classNames="text-xl text-gray-500 hover:text-black" />
121
  </button>
122
  {/if}
 
146
  <WidgetModelLoading estimatedTime={modelLoading.estimatedTime} />
147
  {/if}
148
  <slot name="bottom" />
149
+ <WidgetFooter bind:isMaximized {outputJson} {isDisabled} />
150
  </div>
151
  {/if}