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-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 });
|
|
|
|
|
2024-06-03 00:11:19 +02:00
|
|
|
const meta = {
|
2023-04-20 05:41:34 +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>;
|
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 = {
|
|
|
|
render: () => <PageStory />
|
|
|
|
};
|
|
|
|
|
|
|
|
export const WithManualSetUp: Story = {
|
|
|
|
render: () => (
|
|
|
|
<PageStory
|
|
|
|
kcContext={{
|
|
|
|
mode: "manual"
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
};
|
|
|
|
|
|
|
|
export const WithError: Story = {
|
|
|
|
render: () => (
|
|
|
|
<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)
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
};
|