File size: 873 Bytes
62fead0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
<script lang="ts">
import type { HuggingFaceLibs } from '$lib/types';
interface Props {
hfAuth: HuggingFaceLibs | null;
}
let { hfAuth = null }: Props = $props();
async function handleSignIn() {
if (!hfAuth) return;
const url = await hfAuth.oauthLoginUrl({ scopes: ["inference-api"] });
window.location.href = url;
}
</script>
<button
class="signin-button"
onclick={handleSignIn}
disabled={!hfAuth}
>
Sign in with Hugging Face
</button>
<style>
.signin-button {
background: #ff7b7b;
color: #fff;
border: none;
padding: 0.6rem 1.2rem;
border-radius: 6px;
cursor: pointer;
font-size: 1rem;
transition: background-color 0.2s;
}
.signin-button:hover:not(:disabled) {
background: #ff6565;
}
.signin-button:disabled {
opacity: 0.6;
cursor: not-allowed;
}
</style> |