41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
|
import type { DeepPartial } from "keycloakify/tools/DeepPartial";
|
||
|
import type { KcContext } from "./kcContext";
|
||
|
import { createGetKcContextMock } from "keycloakify/account";
|
||
|
import type {
|
||
|
KcContextExtraProperties,
|
||
|
KcContextExtraPropertiesPerPage
|
||
|
} from "./kcContext";
|
||
|
import KcApp from "./KcApp";
|
||
|
|
||
|
const kcContextExtraProperties: KcContextExtraProperties = {};
|
||
|
const kcContextExtraPropertiesPerPage: KcContextExtraPropertiesPerPage = {};
|
||
|
|
||
|
export const { getKcContextMock } = createGetKcContextMock({
|
||
|
kcContextExtraProperties,
|
||
|
kcContextExtraPropertiesPerPage,
|
||
|
overrides: {},
|
||
|
overridesPerPage: {}
|
||
|
});
|
||
|
|
||
|
export function createPageStory<PageId extends KcContext["pageId"]>(params: { pageId: PageId }) {
|
||
|
const { pageId } = params;
|
||
|
|
||
|
function PageStory(props: { kcContext?: DeepPartial<Extract<KcContext, { pageId: PageId }>> }) {
|
||
|
const { kcContext: overrides } = props;
|
||
|
|
||
|
const kcContextMock = getKcContextMock({
|
||
|
pageId,
|
||
|
overrides
|
||
|
});
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<KcApp kcContext={kcContextMock} />
|
||
|
</>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
return { PageStory };
|
||
|
}
|
||
|
|