keycloak_theme/stories/login/pages/LoginConfigTotp.stories.tsx

39 lines
1022 B
TypeScript
Raw Normal View History

2023-04-20 05:41:34 +02:00
import React from "react";
import type { ComponentMeta } from "@storybook/react";
2024-06-02 22:37:04 +02:00
import { createPageStory, parameters } from "../createPageStory";
2023-04-20 05:41:34 +02:00
const pageId = "login-config-totp.ftl";
const { PageStory } = createPageStory({ pageId });
const meta: ComponentMeta<any> = {
title: `login/${pageId}`,
component: PageStory,
2024-06-02 22:37:04 +02:00
parameters
2023-04-20 05:41:34 +02:00
};
export default meta;
export const Default = () => <PageStory />;
export const WithManualSetUp = () => (
<PageStory
kcContext={{
mode: "manual"
}}
/>
);
export const WithError = () => (
<PageStory
kcContext={{
messagesPerField: {
get: (fieldName: string) => (fieldName === "totp" ? "Invalid TOTP" : undefined),
exists: (fieldName: string) => fieldName === "totp",
existsError: (fieldName: string) => fieldName === "totp",
printIfExists: <T,>(fieldName: string, x: T) => (fieldName === "totp" ? x : undefined)
}
}}
/>
);