keycloak_theme/stories/login/pages/SelectAuthenticator.stories.tsx

85 lines
3.4 KiB
TypeScript
Raw Normal View History

2023-04-20 05:41:34 +02:00
import React from "react";
2024-06-03 00:11:19 +02:00
import type { Meta, StoryObj } from "@storybook/react";
2024-06-09 11:53:25 +02:00
import { createKcPageStory } from "../KcPageStory";
2023-04-20 05:41:34 +02:00
2024-06-09 11:53:25 +02:00
const { KcPageStory } = createKcPageStory({ pageId: "select-authenticator.ftl" });
2023-04-20 05:41:34 +02:00
2024-06-03 00:11:19 +02:00
const meta = {
2024-06-06 07:28:34 +02:00
title: "login/select-authenticator.ftl",
2024-06-09 11:53:25 +02:00
component: KcPageStory
} satisfies Meta<typeof KcPageStory>;
2023-04-20 05:41:34 +02:00
export default meta;
2024-06-03 00:11:19 +02:00
type Story = StoryObj<typeof meta>;
export const Default: Story = {
2024-06-09 11:53:25 +02:00
render: () => <KcPageStory />
2024-06-03 00:11:19 +02:00
};
2024-06-03 00:11:19 +02:00
export const WithDifferentAuthenticationMethods: Story = {
render: () => (
2024-06-09 11:53:25 +02:00
<KcPageStory
2024-06-03 00:11:19 +02:00
kcContext={{
auth: {
authenticationSelections: [
{
authExecId: "25697c4e-0c80-4f2c-8eb7-2c16347e8e8d",
displayName: "auth-username-password-form-display-name",
helpText: "auth-username-password-form-help-text",
iconCssClass: "kcAuthenticatorPasswordClass"
},
{
authExecId: "4cb60872-ce0d-4c8f-a806-e651ed77994b",
displayName: "webauthn-passwordless-display-name",
helpText: "webauthn-passwordless-help-text",
iconCssClass: "kcAuthenticatorWebAuthnPasswordlessClass"
}
]
}
}}
/>
)
};
export const WithRealmTranslations: Story = {
render: () => (
<KcPageStory
kcContext={{
auth: {
authenticationSelections: [
{
authExecId: "f0c22855-eda7-4092-8565-0c22f77d2ffb",
displayName: "home-idp-discovery-display-name",
helpText: "home-idp-discovery-help-text",
iconCssClass: "kcAuthenticatorDefaultClass"
},
{
authExecId: "20456f5a-8b2b-45f3-98e0-551dcb27e3e1",
displayName: "identity-provider-redirctor-display-name",
helpText: "identity-provider-redirctor-help-text",
iconCssClass: "kcAuthenticatorDefaultClass"
},
{
authExecId: "eb435db9-474e-473a-8da7-c184fa510b96",
displayName: "auth-username-password-form-display-name",
helpText: "auth-username-password-help-text",
iconCssClass: "kcAuthenticatorDefaultClass"
}
]
},
"x-keycloakify": {
messages: {
"home-idp-discovery-display-name": "Home identity provider",
"home-idp-discovery-help-text":
"Sign in via your home identity provider which will be automatically determined based on your provided email address.",
"identity-provider-redirctor-display-name": "Identity Provider Redirector",
"identity-provider-redirctor-help-text": "Sign in via your identity provider.",
"auth-username-password-help-text": "Sign in via your username and password."
}
}
}}
/>
)
};