Spaces:
Running
Running
responsive menu
Browse files
src/lib/components/ProTag.svelte
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
<div class="inline-block -skew-x-12 bg-gradient-to-br text-sm font-bold shadow-lg from-pink-500 via-green-500 to-yellow-500 text-black shadow-green-500/20 rounded-lg px-2.5 py-0.5">
|
| 2 |
PRO
|
| 3 |
</div>
|
|
|
|
| 1 |
+
<div class="inline-block -skew-x-12 bg-gradient-to-br text-sm font-bold shadow-lg from-pink-500 via-green-500 to-yellow-500 text-black shadow-green-500/20 rounded-lg px-1.5 xl:px-2.5 py-0.5">
|
| 2 |
PRO
|
| 3 |
</div>
|
src/lib/components/sidebar/Sidebar.svelte
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
<script>
|
| 2 |
import Icon from '@iconify/svelte';
|
| 3 |
|
| 4 |
import logo from '$lib/images/hf-logo.svg';
|
|
@@ -7,45 +7,64 @@
|
|
| 7 |
import SecondaryLink from '$lib/components/sidebar/links/Secondary.svelte';
|
| 8 |
|
| 9 |
const LINKS = [
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
];
|
| 25 |
|
| 26 |
-
const FEW_SHOTS = [
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
];
|
|
|
|
|
|
|
| 38 |
|
| 39 |
</script>
|
| 40 |
|
| 41 |
-
<
|
| 42 |
-
<header class="flex items-center justify-start
|
| 43 |
-
<img src={logo} alt="Logo" width={
|
| 44 |
<div class="flex items-center justify-start gap-2">
|
| 45 |
-
<p class="text-white font-bold text-
|
| 46 |
<ProTag />
|
| 47 |
</div>
|
| 48 |
</header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
<nav class="grid grid-cols-1 gap-8 px-4">
|
| 50 |
<a
|
| 51 |
href="https://huggingface.co/pricing#pro"
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
import Icon from '@iconify/svelte';
|
| 3 |
|
| 4 |
import logo from '$lib/images/hf-logo.svg';
|
|
|
|
| 7 |
import SecondaryLink from '$lib/components/sidebar/links/Secondary.svelte';
|
| 8 |
|
| 9 |
const LINKS = [
|
| 10 |
+
{
|
| 11 |
+
path: "/text-generation",
|
| 12 |
+
label: "Text Generation",
|
| 13 |
+
description: "Generate text from a prompt, using a model of your choice.",
|
| 14 |
+
icon: "heroicons:chat-bubble-left-right-20-solid",
|
| 15 |
+
type: "green",
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
path: "/image-generation",
|
| 19 |
+
label: "Image Generation",
|
| 20 |
+
description: "Generate images from a prompt, using a model of your choice.",
|
| 21 |
+
icon: "ph:images-square-fill",
|
| 22 |
+
type: "pink",
|
| 23 |
+
},
|
| 24 |
+
];
|
| 25 |
|
| 26 |
+
const FEW_SHOTS = [
|
| 27 |
+
{
|
| 28 |
+
path: "/text-generation/translation",
|
| 29 |
+
label: "Translation",
|
| 30 |
+
icon: "bi:translate",
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
path: "/text-generation/chat",
|
| 34 |
+
label: "Chat",
|
| 35 |
+
icon: "ph:chat-dots-fill",
|
| 36 |
+
},
|
| 37 |
+
];
|
| 38 |
+
|
| 39 |
+
let open: boolean = false;
|
| 40 |
|
| 41 |
</script>
|
| 42 |
|
| 43 |
+
<div class="xl:hidden bg-slate-900 w-full px-8 py-5 border-b border-slate-800 flex items-center justify-between">
|
| 44 |
+
<header class="flex items-center justify-start gap-4">
|
| 45 |
+
<img src={logo} alt="Logo" width={28} height={28} />
|
| 46 |
<div class="flex items-center justify-start gap-2">
|
| 47 |
+
<p class="text-white font-bold text-lg">Inference API for</p>
|
| 48 |
<ProTag />
|
| 49 |
</div>
|
| 50 |
</header>
|
| 51 |
+
<button on:click={() => open = true}>
|
| 52 |
+
<Icon icon="line-md:menu" class="text-slate-100 w-5 h-5" />
|
| 53 |
+
</button>
|
| 54 |
+
</div>
|
| 55 |
+
<aside class={`${open ? '' : '-translate-x-full'} z-10 absolute xl:relative transition-all duration-200 xl:!translate-x-0 bg-slate-900 w-full xl:max-w-[360px] h-screen border-r border-slate-800 text-white`}>
|
| 56 |
+
<header class="flex items-center justify-between p-8 gap-4">
|
| 57 |
+
<div class="flex items-center justify-start gap-4">
|
| 58 |
+
<img src={logo} alt="Logo" width={34} height={34} />
|
| 59 |
+
<div class="flex items-center justify-start gap-2">
|
| 60 |
+
<p class="text-white font-bold text-xl">Inference API for</p>
|
| 61 |
+
<ProTag />
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
<button class="xl:hidden" on:click={() => open = false}>
|
| 65 |
+
<Icon icon="tdesign:close" class="text-slate-100 w-6 h-6" />
|
| 66 |
+
</button>
|
| 67 |
+
</header>
|
| 68 |
<nav class="grid grid-cols-1 gap-8 px-4">
|
| 69 |
<a
|
| 70 |
href="https://huggingface.co/pricing#pro"
|
src/lib/utils/clickOutside.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export function clickOutside(node) {
|
| 2 |
+
|
| 3 |
+
window.addEventListener('click', handleClick);
|
| 4 |
+
|
| 5 |
+
function handleClick(e){
|
| 6 |
+
if (!node.contains(e.target)){
|
| 7 |
+
node.dispatchEvent(new CustomEvent('outsideclick'))
|
| 8 |
+
}
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
return {
|
| 12 |
+
destroy() {
|
| 13 |
+
// the node has been removed from the DOM
|
| 14 |
+
window.removeEventListener('click', handleClick)
|
| 15 |
+
}
|
| 16 |
+
};
|
| 17 |
+
}
|
src/routes/+layout.svelte
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
import '$lib/styles/tailwind.css';
|
| 4 |
</script>
|
| 5 |
|
| 6 |
-
<div class="app flex items-start justify-start overflow-auto h-screen lg:h-auto lg:overflow-hidden">
|
| 7 |
<Sidebar />
|
| 8 |
|
| 9 |
<slot />
|
|
|
|
| 3 |
import '$lib/styles/tailwind.css';
|
| 4 |
</script>
|
| 5 |
|
| 6 |
+
<div class="app flex xl:flex-row flex-col items-start justify-start overflow-y-auto overflow-x-hidden h-screen lg:h-auto lg:overflow-hidden">
|
| 7 |
<Sidebar />
|
| 8 |
|
| 9 |
<slot />
|