2023-04-17 00:15:41 +02:00
|
|
|
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,
|
2023-04-17 01:55:46 +02:00
|
|
|
storyPartialKcContext: params.kcContext
|
2023-04-17 00:15:41 +02:00
|
|
|
});
|
|
|
|
|
|
2023-11-02 21:27:34 +01:00
|
|
|
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="fonts/WorkSans/font.css" />
|
|
|
|
|
<KcApp kcContext={kcContext} />
|
|
|
|
|
</>
|
|
|
|
|
);
|
2023-04-17 00:15:41 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return { PageStory };
|
|
|
|
|
|
|
|
|
|
}
|