Complete migration of storybook from @lordvlad #274

This commit is contained in:
Joseph Garrone
2024-06-02 22:29:53 +02:00
parent 96a88fe865
commit f55a934939
6 changed files with 197 additions and 1 deletions

View File

@ -22,3 +22,78 @@ const meta: ComponentMeta<any> = {
export default meta;
export const Default = () => <PageStory />;
export const WithFieldError = () => (
<PageStory
kcContext={{
profile: {
attributes: [
{
name: "email",
value: "max.mustermann@gmail.com"
}
]
},
messagesPerField: {
existsError: (fieldName: string) => fieldName === "email",
exists: (fieldName: string) => fieldName === "email",
get: (fieldName: string) => (fieldName === "email" ? "I don't like your email address" : undefined),
printIfExists: <T,>(fieldName: string, x: T) => (fieldName === "email" ? x : undefined)
}
}}
/>
);
export const WithEmailAsUsername = () => (
<PageStory
kcContext={{
realm: {
registrationEmailAsUsername: true
}
}}
/>
);
export const WithoutPassword = () => (
<PageStory
kcContext={{
passwordRequired: false
}}
/>
);
export const WithRecaptcha = () => (
<PageStory
kcContext={{
recaptchaRequired: true,
recaptchaSiteKey: "foobar"
}}
/>
);
export const WithPresets = () => (
<PageStory
kcContext={{
profile: {
attributes: [
{
name: "firstName",
value: "Max"
},
{
name: "lastName",
value: "Mustermann"
},
{
name: "email",
value: "max.mustermann@gmail.com"
},
{
name: "username",
value: "max.mustermann"
}
]
}
}}
/>
);