svelte-oidc/src/components/LoginButton.svelte
Chris Hickingbottom a703572dc2
Update LogonButton to all customizable style designs
Added classes and styles attributes that allow the button to be styled by the developer.
2023-01-20 11:55:19 -06:00

16 lines
583 B
Svelte

<script>
import { getContext } from 'svelte';
import {
OIDC_CONTEXT_CLIENT_PROMISE,
OIDC_CONTEXT_REDIRECT_URI,
login,
} from './OidcContext.svelte';
const oidcPromise = getContext(OIDC_CONTEXT_CLIENT_PROMISE)
export let callback_url = getContext(OIDC_CONTEXT_REDIRECT_URI)
export let preserveRoute
export let classes = ''
export let styles = ''
</script>
<button class="btn {classes}" style="{styles}" on:click|preventDefault='{() => login(oidcPromise, preserveRoute, callback_url) }'><slot></slot></button>