Setup a very basic storybook
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { getKcContext, type KcContext } from "./kcContext";
|
||||
import KcApp from "./KcApp";
|
||||
import type { DeepPartial } from "keycloakify/tools/DeepPartial";
|
||||
|
||||
export function createPageStory<PageId extends KcContext["pageId"]>(params: {
|
||||
pageId: PageId;
|
||||
}) {
|
||||
|
||||
const { pageId } = params;
|
||||
|
||||
function PageStory(params: { kcContext?: DeepPartial<Extract<KcContext, { pageId: PageId }>>; }) {
|
||||
|
||||
const { kcContext } = getKcContext({
|
||||
mockPageId: pageId,
|
||||
storyParams: params.kcContext
|
||||
});
|
||||
|
||||
return <KcApp kcContext={kcContext} />;
|
||||
|
||||
}
|
||||
|
||||
return { PageStory };
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user