feat: add size prop to Avatar component
Browse files
src/lib/components/Avatar.svelte
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<script lang="ts">
|
2 |
export let orgName: string;
|
3 |
-
export let size:
|
|
|
|
|
4 |
|
5 |
async function getAvatarUrl(orgName: string) {
|
6 |
const url = `https://huggingface.co/api/organizations/${orgName}/avatar`;
|
@@ -16,9 +18,9 @@
|
|
16 |
</script>
|
17 |
|
18 |
{#await getAvatarUrl(orgName)}
|
19 |
-
<div class="
|
20 |
{:then avatarUrl}
|
21 |
-
<img class="
|
22 |
{:catch}
|
23 |
-
<div class="
|
24 |
{/await}
|
|
|
1 |
<script lang="ts">
|
2 |
export let orgName: string;
|
3 |
+
export let size: "sm" | "md" = "md";
|
4 |
+
|
5 |
+
const sizeClass = size === "sm" ? "size-3" : "size-4";
|
6 |
|
7 |
async function getAvatarUrl(orgName: string) {
|
8 |
const url = `https://huggingface.co/api/organizations/${orgName}/avatar`;
|
|
|
18 |
</script>
|
19 |
|
20 |
{#await getAvatarUrl(orgName)}
|
21 |
+
<div class="{sizeClass} flex-none rounded bg-gray-200"></div>
|
22 |
{:then avatarUrl}
|
23 |
+
<img class="{sizeClass} flex-none rounded bg-gray-200 object-cover" src={avatarUrl} alt="{orgName} avatar" />
|
24 |
{:catch}
|
25 |
+
<div class="{sizeClass} flex-none rounded bg-gray-200"></div>
|
26 |
{/await}
|
src/lib/components/InferencePlayground/InferencePlaygroundModelSelector.svelte
CHANGED
@@ -52,7 +52,7 @@
|
|
52 |
>
|
53 |
<div class="flex flex-col items-start">
|
54 |
<div class="flex items-center gap-1 text-sm text-gray-500 dark:text-gray-300">
|
55 |
-
<Avatar orgName={nameSpace} size=
|
56 |
{nameSpace}
|
57 |
</div>
|
58 |
<div>{modelName}</div>
|
|
|
52 |
>
|
53 |
<div class="flex flex-col items-start">
|
54 |
<div class="flex items-center gap-1 text-sm text-gray-500 dark:text-gray-300">
|
55 |
+
<Avatar orgName={nameSpace} size="sm" />
|
56 |
{nameSpace}
|
57 |
</div>
|
58 |
<div>{modelName}</div>
|