From f55a934939a17b1b3d409db33d3dfd272090aecd Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sun, 2 Jun 2024 22:29:53 +0200 Subject: [PATCH] Complete migration of storybook from @lordvlad #274 --- stories/login/pages/Info.stories.tsx | 57 +++++++++++++- .../login/pages/LoginConfigTotp.stories.tsx | 21 ++++++ .../pages/LoginResetPassword.stories.tsx | 11 +++ stories/login/pages/LoginUsername.stories.tsx | 11 +++ stories/login/pages/Register.stories.tsx | 75 +++++++++++++++++++ .../pages/SelectAuthenticator.stories.tsx | 23 ++++++ 6 files changed, 197 insertions(+), 1 deletion(-) diff --git a/stories/login/pages/Info.stories.tsx b/stories/login/pages/Info.stories.tsx index 2e145ae7..d5d57ea0 100644 --- a/stories/login/pages/Info.stories.tsx +++ b/stories/login/pages/Info.stories.tsx @@ -25,9 +25,64 @@ export const Default = () => ( ); + +export const WithWarning = () => ( + +); + +export const WithError = () => ( + +); + +export const WithSuccess = () => ( + +); + +export const WithLinkBack = () => ( + +); + +export const WithRequiredActions = () => ( + +); diff --git a/stories/login/pages/LoginConfigTotp.stories.tsx b/stories/login/pages/LoginConfigTotp.stories.tsx index aa0f2ec7..d8a05c59 100644 --- a/stories/login/pages/LoginConfigTotp.stories.tsx +++ b/stories/login/pages/LoginConfigTotp.stories.tsx @@ -22,3 +22,24 @@ const meta: ComponentMeta = { export default meta; export const Default = () => ; + +export const WithManualSetUp = () => ( + +); + +export const WithError = () => ( + (fieldName === "totp" ? "Invalid TOTP" : undefined), + exists: (fieldName: string) => fieldName === "totp", + existsError: (fieldName: string) => fieldName === "totp", + printIfExists: (fieldName: string, x: T) => (fieldName === "totp" ? x : undefined) + } + }} + /> +); diff --git a/stories/login/pages/LoginResetPassword.stories.tsx b/stories/login/pages/LoginResetPassword.stories.tsx index 12a6eb3f..0dca68a8 100644 --- a/stories/login/pages/LoginResetPassword.stories.tsx +++ b/stories/login/pages/LoginResetPassword.stories.tsx @@ -22,3 +22,14 @@ const meta: ComponentMeta = { export default meta; export const Default = () => ; + +export const WithEmailAsUsername = () => ( + +); diff --git a/stories/login/pages/LoginUsername.stories.tsx b/stories/login/pages/LoginUsername.stories.tsx index cb909026..25f5f256 100644 --- a/stories/login/pages/LoginUsername.stories.tsx +++ b/stories/login/pages/LoginUsername.stories.tsx @@ -22,3 +22,14 @@ const meta: ComponentMeta = { export default meta; export const Default = () => ; + +export const WithEmailAsUsername = () => ( + +); diff --git a/stories/login/pages/Register.stories.tsx b/stories/login/pages/Register.stories.tsx index 89d8c9b5..03653c54 100644 --- a/stories/login/pages/Register.stories.tsx +++ b/stories/login/pages/Register.stories.tsx @@ -22,3 +22,78 @@ const meta: ComponentMeta = { export default meta; export const Default = () => ; + +export const WithFieldError = () => ( + fieldName === "email", + exists: (fieldName: string) => fieldName === "email", + get: (fieldName: string) => (fieldName === "email" ? "I don't like your email address" : undefined), + printIfExists: (fieldName: string, x: T) => (fieldName === "email" ? x : undefined) + } + }} + /> +); + +export const WithEmailAsUsername = () => ( + +); + +export const WithoutPassword = () => ( + +); + +export const WithRecaptcha = () => ( + +); + +export const WithPresets = () => ( + +); diff --git a/stories/login/pages/SelectAuthenticator.stories.tsx b/stories/login/pages/SelectAuthenticator.stories.tsx index 8000b7c7..17ab3190 100644 --- a/stories/login/pages/SelectAuthenticator.stories.tsx +++ b/stories/login/pages/SelectAuthenticator.stories.tsx @@ -22,3 +22,26 @@ const meta: ComponentMeta = { export default meta; export const Default = () => ; + +export const WithDifferentAuthenticationMethods = () => ( + +);