Skip to content

Commit

Permalink
feat: allow slots for buttons in login to be customized
Browse files Browse the repository at this point in the history
  • Loading branch information
davidma415 committed Apr 9, 2024
1 parent d8ac430 commit 26aaea3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/components/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
size="large"
@click.prevent="redirectToIdp(idpLoginCallbackUrl, idpLoginReturnTo)"
>
<ProgressIcon v-if="idpIsLoading" class="spin-icon" :size="KUI_ICON_SIZE_40" />
<ProfileIcon v-else :size="KUI_ICON_SIZE_40" />
{{ messages.login.loginTextSSO }}
<slot name="login-sso-button">
<ProgressIcon v-if="idpIsLoading" class="spin-icon" :size="KUI_ICON_SIZE_40" />
<ProfileIcon v-else :size="KUI_ICON_SIZE_40" />
<span data-testid="kong-auth-login-sso-button-default-text">{{ messages.login.loginTextSSO }}</span>
</slot>
</KButton>

<p v-if="loginWithCredentialsLinkIsVisible" class="basic-auth-link">
Expand Down Expand Up @@ -122,8 +124,10 @@
size="large"
type="submit"
>
<ProgressIcon v-if="['pending', 'success'].some(currentState.matches)" class="spin-icon" :size="KUI_ICON_SIZE_40" />
{{ loginBtnText }}
<slot name="login-button">
<ProgressIcon v-if="['pending', 'success'].some(currentState.matches)" class="spin-icon" :size="KUI_ICON_SIZE_40" />
<span data-testid="kong-auth-login-button-default-text">{{ loginBtnText }}</span>
</slot>
</KButton>

<div v-if="showRegisterLink" class="register-link-wrapper">
Expand Down
9 changes: 8 additions & 1 deletion src/elements/kong-auth-login/KongAuthLogin.ce.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
@idp-is-loading="(emitData: any) => $emit('idp-is-loading', emitData)"
@login-success="(emitData: any) => $emit('login-success', emitData)"
@verify-email-success="(emitData: any) => $emit('verify-email-success', emitData)"
/>
>
<template #login-sso-button>
<slot name="login-sso-button" />
</template>
<template #login-button>
<slot name="login-button" />
</template>
</LoginForm>
</BaseCustomElement>
</TeleportWrapper>
</template>
Expand Down

0 comments on commit 26aaea3

Please sign in to comment.