Migrate to storybook 7

This commit is contained in:
Joseph Garrone committed 2024-02-13 01:03:13 +01:00
1 parent f2100374dc
commit 8e1a34e8f0
18 files changed
+4902 -334

No files matched your search

@@ -15,7 +15,13 @@ export function createPageStory<PageId extends KcContext["pageId"]>(params: {
storyPartialKcContext: params.kcContext
});
return <KcApp kcContext={kcContext} />;
return (
<>
{/* If you import custom fonts in your index.html you have to import them in storybook as well*/}
<link rel="stylesheet" type="text/css" href={`${import.meta.env.BASE_URL}fonts/WorkSans/font.css`} />
<KcApp kcContext={kcContext} />
</>
);
}
@@ -1,18 +1,22 @@
import { ComponentStory, ComponentMeta } from "@storybook/react";
import { Meta, StoryObj } from '@storybook/react';
import { createPageStory } from "../createPageStory";
const { PageStory } = createPageStory({
pageId: "password.ftl"
});
export default {
const meta = {
title: "account/Password",
component: PageStory,
} as ComponentMeta<typeof PageStory>;
} satisfies Meta<typeof PageStory>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: ComponentStory<typeof PageStory> = () => <PageStory
kcContext={{
message: { type: "success", summary: "This is a test message" }
}}
/>;
export const Default: Story = {
render: () => <PageStory
kcContext={{
message: { type: "success", summary: "This is a test message" }
}}
/>
};
+3 -3
View File
@@ -60,12 +60,12 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
style={{ "fontFamily": '"Work Sans"' }}
>
{/*
This is just to show you how it can be done but this is not the best option for importing assets.
See: https://docs.keycloakify.dev/importing-assets#importing-custom-assets
Here we are referencing the `keycloakify-logo.png` in the `public` directory.
When possible don't use this approach, instead ...
*/}
<img src={`${import.meta.env.BASE_URL}keycloakify-logo.png`} alt="Keycloakify logo" width={50} />
{msg("loginTitleHtml", realm.displayNameHtml)}!!!
{/* This is the preferred way to use assets */}
{/* ...rely on the bundler to import your assets, it's more efficient */}
<img src={keycloakifyLogoPngUrl} alt="Keycloakify logo" width={50} />
</div>
</div>
Loaded 3 of 18 files, more files were not shown because too many files have changed in this diff. Show more