From 050e2b2b997d3d68f51dee1af60b3c8983e34c62 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Fri, 28 Jun 2024 06:46:26 +0200 Subject: [PATCH] Improve Register page default stories --- src/bin/add-story.ts | 3 +- stories/login/pages/Register.stories.tsx | 97 ++++++++++++++++-------- 2 files changed, 69 insertions(+), 31 deletions(-) diff --git a/src/bin/add-story.ts b/src/bin/add-story.ts index 23a1df4b..f2a080e9 100644 --- a/src/bin/add-story.ts +++ b/src/bin/add-story.ts @@ -81,7 +81,8 @@ export async function command(params: { cliCommandOptions: CliCommandOptions }) ) ) .toString("utf8") - .replace('import React from "react";\n', ""); + .replace('import React from "react";\n', "") + .replace(/from "[./]+dist\//, 'from "keycloakify/'); { const targetDirPath = pathDirname(targetFilePath); diff --git a/stories/login/pages/Register.stories.tsx b/stories/login/pages/Register.stories.tsx index efd58340..54d10674 100644 --- a/stories/login/pages/Register.stories.tsx +++ b/stories/login/pages/Register.stories.tsx @@ -1,6 +1,7 @@ import React from "react"; import type { Meta, StoryObj } from "@storybook/react"; import { createKcPageStory } from "../KcPageStory"; +import type { Attribute } from "../../../dist/login"; const { KcPageStory } = createKcPageStory({ pageId: "register.ftl" }); @@ -48,23 +49,84 @@ export const WithEmailAlreadyExists: Story = { ) }; -export const WithEmailAsUsername: Story = { +export const WithRestrictedToMITStudents: Story = { render: () => ( @mit.edu) nor a Berkeley (@berkeley.edu) email." + } } }} /> ) }; -export const WithoutPassword: Story = { +export const WithFavoritePet: Story = { render: () => ( + ) +}; + +export const WithEmailAsUsername: Story = { + render: () => ( + ) @@ -97,31 +159,6 @@ export const WithRecaptchaFrench: Story = { ) }; -export const WithPresets: Story = { - render: () => ( - - ) -}; - export const WithPasswordMinLength8: Story = { render: () => (