Commit for saving

This commit is contained in:
garronej committed 2023-02-26 12:32:22 +01:00
1 parent 1539980f66
commit 3d0736e72b
21 files changed
+604 -319

No files matched your search

+5 -4
View File
@@ -19,7 +19,7 @@ yarn
yarn keycloak # Build the theme one time (some assets will be copied to
# public/keycloak_static, they are needed to dev your page outside of Keycloak)
yarn start # See the Hello World app
# Uncomment line 15 of src/KcApp/kcContext, reload https://localhost:3000
# Uncomment line 15 of src/keycloakTheme/kcContext, reload https://localhost:3000
# You can now develop your Login pages.
# Think your theme is ready? Run
@@ -89,14 +89,15 @@ and remove unnecessary file.
```bash
rm -r src/App
rm src/KcApp/index.ts
mv src/KcApp/* src/
rm src/keycloakTheme/index.ts
mv src/keycloakTheme/* src/
rm -r src/keycloakTheme
cat << EOF > src/index.tsx
import { createRoot } from "react-dom/client";
import { StrictMode } from "react";
import { kcContext } from "./kcContext";
import KcApp from "KcApp";
import KcApp from "./KcApp";
if( kcContext === undefined ){
throw new Error(
+5 -2
View File
@@ -33,13 +33,16 @@
"@types/react": "18.0.9",
"@types/react-dom": "18.0.4",
"react-scripts": "5.0.0",
"typescript": "^4.7.3"
"typescript": "^4.9.5"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
],
"rules": {
"react-hooks/exhaustive-deps": "off"
}
},
"browserslist": {
"production": [
-45
View File
@@ -1,45 +0,0 @@
import "./KcApp.css";
import { lazy, Suspense } from "react";
import type { KcContext } from "./kcContext";
import KcAppBase, { defaultKcProps } from "keycloakify";
import { useI18n } from "./i18n";
const Register = lazy(() => import("./Register"));
const Terms = lazy(() => import("./Terms"));
const MyExtraPage1 = lazy(() => import("./MyExtraPage1"));
const MyExtraPage2 = lazy(() => import("./MyExtraPage2"));
export type Props = {
kcContext: KcContext;
};
export default function KcApp({ kcContext }: Props) {
const i18n = useI18n({ kcContext });
//NOTE: Locales not yet downloaded
if (i18n === null) {
return null;
}
const props = {
i18n,
...defaultKcProps,
// NOTE: The classes are defined in ./KcApp.css
"kcHeaderWrapperClass": "my-color my-font",
};
return (
<Suspense>
{(() => {
switch (kcContext.pageId) {
case "register.ftl": return <Register {...{ kcContext, ...props }} />;
case "terms.ftl": return <Terms {...{ kcContext, ...props }} />;
case "my-extra-page-1.ftl": return <MyExtraPage1 {...{ kcContext, ...props }} />;
case "my-extra-page-2.ftl": return <MyExtraPage2 {...{ kcContext, ...props }} />;
default: return <KcAppBase {...{ kcContext, ...props }} />;
}
})()}
</Suspense>
);
}
Loaded 3 of 21 files, more files were not shown because too many files have changed in this diff. Show more