This commit is contained in:
Joseph Garrone 2024-06-09 15:00:18 +02:00
parent af7733b3dc
commit 34971c67de
9 changed files with 17 additions and 25 deletions

View File

@ -12,6 +12,6 @@ const config: StorybookConfig = {
name: "@storybook/react-vite", name: "@storybook/react-vite",
options: {} options: {}
}, },
staticDirs: ["../public"], staticDirs: ["../public"]
}; };
export default config; export default config;

View File

@ -18,7 +18,7 @@ yarn build-keycloak-theme
# Storybook # Storybook
Spin up a test environment for your Keycloak pages. Spin up a test environment for your Keycloak pages.
```bash ```bash
npx keycloakify add-story # Select the pages you want to add stories for npx keycloakify add-story # Select the pages you want to add stories for
@ -28,7 +28,7 @@ yarn storybook # Start Storybook
# Test in a real Keycloak environment # Test in a real Keycloak environment
Test your theme in a local Keycloak docker container. Test your theme in a local Keycloak docker container.
You need to have Docker running. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/) if you don't have it. You need to have Docker running. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/) if you don't have it.
```bash ```bash
npx keycloakify start-keycloak npx keycloakify start-keycloak
@ -85,7 +85,7 @@ You'll need to apply theses changes to the `src/main.tsx` file:
</Suspense> </Suspense>
</StrictMode> </StrictMode>
); );
declare global { declare global {
interface Window { interface Window {
kcContext?: kcContext?:

View File

@ -48,4 +48,4 @@
"resolutions": { "resolutions": {
"jackspeak": "2.1.1" "jackspeak": "2.1.1"
} }
} }

View File

@ -9,7 +9,4 @@ export type KcContextExtension = {
export type KcContextExtensionPerPage = {}; export type KcContextExtensionPerPage = {};
export type KcContext = ExtendKcContext< export type KcContext = ExtendKcContext<KcContextExtension, KcContextExtensionPerPage>;
KcContextExtension,
KcContextExtensionPerPage
>;

View File

@ -1,10 +1,7 @@
import type { DeepPartial } from "keycloakify/tools/DeepPartial"; import type { DeepPartial } from "keycloakify/tools/DeepPartial";
import type { KcContext } from "./KcContext"; import type { KcContext } from "./KcContext";
import { createGetKcContextMock } from "keycloakify/account/KcContext"; import { createGetKcContextMock } from "keycloakify/account/KcContext";
import type { import type { KcContextExtension, KcContextExtensionPerPage } from "./KcContext";
KcContextExtension,
KcContextExtensionPerPage
} from "./KcContext";
import KcPage from "./KcPage"; import KcPage from "./KcPage";
import { themeNames, kcEnvDefaults } from "../kc.gen"; import { themeNames, kcEnvDefaults } from "../kc.gen";

View File

@ -18,4 +18,4 @@ export const KcEnvNames: KcEnvName[] = [];
export const kcEnvDefaults: Record<KcEnvName, string> = {}; export const kcEnvDefaults: Record<KcEnvName, string> = {};
/* prettier-ignore-end */ /* prettier-ignore-end */

View File

@ -9,7 +9,4 @@ export type KcContextExtension = {
export type KcContextExtensionPerPage = {}; export type KcContextExtensionPerPage = {};
export type KcContext = ExtendKcContext< export type KcContext = ExtendKcContext<KcContextExtension, KcContextExtensionPerPage>;
KcContextExtension,
KcContextExtensionPerPage
>;

View File

@ -5,7 +5,9 @@ import { useDownloadTerms } from "keycloakify/login";
import { useI18n } from "./i18n"; import { useI18n } from "./i18n";
import DefaultPage from "keycloakify/login/DefaultPage"; import DefaultPage from "keycloakify/login/DefaultPage";
import Template from "keycloakify/login/Template"; import Template from "keycloakify/login/Template";
const UserProfileFormFields = lazy(() => import("keycloakify/login/UserProfileFormFields")); const UserProfileFormFields = lazy(
() => import("keycloakify/login/UserProfileFormFields")
);
const doMakeUserConfirmPassword = true; const doMakeUserConfirmPassword = true;
@ -31,7 +33,9 @@ export default function KcApp(props: { kcContext: KcContext }) {
break; break;
} }
const termsMarkdown = await fetch(`${import.meta.env.BASE_URL}terms/${termsFileName}`).then(r => r.text()); const termsMarkdown = await fetch(
`${import.meta.env.BASE_URL}terms/${termsFileName}`
).then(r => r.text());
return { termsMarkdown, termsLanguageTag }; return { termsMarkdown, termsLanguageTag };
} }
@ -61,4 +65,4 @@ export default function KcApp(props: { kcContext: KcContext }) {
); );
} }
const classes = {} satisfies { [key in ClassKey]?: string }; const classes = {} satisfies { [key in ClassKey]?: string };

View File

@ -2,10 +2,7 @@ import type { DeepPartial } from "keycloakify/tools/DeepPartial";
import type { KcContext } from "./KcContext"; import type { KcContext } from "./KcContext";
import KcPage from "./KcPage"; import KcPage from "./KcPage";
import { createGetKcContextMock } from "keycloakify/login/KcContext"; import { createGetKcContextMock } from "keycloakify/login/KcContext";
import type { import type { KcContextExtension, KcContextExtensionPerPage } from "./KcContext";
KcContextExtension,
KcContextExtensionPerPage
} from "./KcContext";
import { themeNames, kcEnvDefaults } from "../kc.gen"; import { themeNames, kcEnvDefaults } from "../kc.gen";
const kcContextExtension: KcContextExtension = { const kcContextExtension: KcContextExtension = {