keycloak_theme/stories/login/pages/Login.stories.tsx

186 lines
5.3 KiB
TypeScript
Raw Normal View History

import React from "react";
2024-06-03 00:11:19 +02:00
import type { Meta, StoryObj } from "@storybook/react";
2024-06-05 21:44:26 +02:00
import { createPageStory, parameters } from "../PageStory";
const pageId = "login.ftl";
const { PageStory } = createPageStory({ pageId });
2024-06-03 00:11:19 +02:00
const meta = {
2023-04-20 02:52:49 +02:00
title: `login/${pageId}`,
component: PageStory,
2024-06-02 22:37:04 +02:00
parameters
2024-06-03 00:11:19 +02:00
} satisfies Meta<typeof PageStory>;
export default meta;
2024-06-03 00:11:19 +02:00
type Story = StoryObj<typeof meta>;
2024-06-03 00:11:19 +02:00
export const Default: Story = {
render: () => <PageStory />
};
2024-06-03 00:11:19 +02:00
export const WithoutRegistration: Story = {
render: () => (
<PageStory
kcContext={{
realm: { registrationAllowed: false }
}}
/>
)
};
2024-06-03 00:11:19 +02:00
export const WithoutRememberMe: Story = {
render: () => (
<PageStory
kcContext={{
realm: { rememberMe: false }
}}
/>
)
};
2024-06-03 00:11:19 +02:00
export const WithoutPasswordReset: Story = {
render: () => (
<PageStory
kcContext={{
realm: { resetPasswordAllowed: false }
}}
/>
)
};
2024-06-03 00:11:19 +02:00
export const WithEmailAsUsername: Story = {
render: () => (
<PageStory
kcContext={{
realm: { loginWithEmailAllowed: false }
}}
/>
)
};
2024-06-03 00:11:19 +02:00
export const WithPresetUsername: Story = {
render: () => (
<PageStory
kcContext={{
login: { username: "max.mustermann@mail.com" }
}}
/>
)
};
2024-06-03 00:11:19 +02:00
export const WithImmutablePresetUsername: Story = {
render: () => (
<PageStory
kcContext={{
auth: {
attemptedUsername: "max.mustermann@mail.com",
showUsername: true
},
usernameHidden: true,
message: {
type: "info",
summary: "Please re-authenticate to continue"
}
}}
/>
)
};
export const WithSocialProviders: Story = {
render: () => (
<PageStory
kcContext={{
social: {
displayInfo: true,
providers: [
{
loginUrl: "google",
alias: "google",
providerId: "google",
displayName: "Google"
},
{
loginUrl: "microsoft",
alias: "microsoft",
providerId: "microsoft",
displayName: "Microsoft"
},
{
loginUrl: "facebook",
alias: "facebook",
providerId: "facebook",
displayName: "Facebook"
},
{
loginUrl: "instagram",
alias: "instagram",
providerId: "instagram",
displayName: "Instagram"
},
{
loginUrl: "twitter",
alias: "twitter",
providerId: "twitter",
displayName: "Twitter"
},
{
loginUrl: "linkedin",
alias: "linkedin",
providerId: "linkedin",
displayName: "LinkedIn"
},
{
loginUrl: "stackoverflow",
alias: "stackoverflow",
providerId: "stackoverflow",
displayName: "Stackoverflow"
},
{
loginUrl: "github",
alias: "github",
providerId: "github",
displayName: "Github"
},
{
loginUrl: "gitlab",
alias: "gitlab",
providerId: "gitlab",
displayName: "Gitlab"
},
{
loginUrl: "bitbucket",
alias: "bitbucket",
providerId: "bitbucket",
displayName: "Bitbucket"
},
{
loginUrl: "paypal",
alias: "paypal",
providerId: "paypal",
displayName: "PayPal"
},
{
loginUrl: "openshift",
alias: "openshift",
providerId: "openshift",
displayName: "OpenShift"
}
]
}
}}
/>
)
};
export const WithoutPasswordField: Story = {
render: () => (
<PageStory
kcContext={{
realm: { password: false }
}}
/>
)
};