From 688455d0aa8d8f54dfc21cbb28464cb7b79440b8 Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 13 Oct 2022 11:58:31 +0200 Subject: [PATCH] #191: Enable to only customize the Template --- src/lib/components/Error.tsx | 65 ++-- src/lib/components/IdpReviewUserProfile.tsx | 87 ++--- src/lib/components/Info.tsx | 91 ++--- src/lib/components/KcApp.tsx | 143 ++++---- src/lib/components/Login.tsx | 353 ++++++++++---------- src/lib/components/LoginConfigTotp.tsx | 325 +++++++++--------- src/lib/components/LoginIdpLinkConfirm.tsx | 99 +++--- src/lib/components/LoginIdpLinkEmail.tsx | 65 ++-- src/lib/components/LoginOtp.tsx | 161 ++++----- src/lib/components/LoginPageExpired.tsx | 73 ++-- src/lib/components/LoginPassword.tsx | 155 ++++----- src/lib/components/LoginResetPassword.tsx | 131 ++++---- src/lib/components/LoginUpdatePassword.tsx | 215 ++++++------ src/lib/components/LoginUpdateProfile.tsx | 217 ++++++------ src/lib/components/LoginUsername.tsx | 287 ++++++++-------- src/lib/components/LoginVerifyEmail.tsx | 65 ++-- src/lib/components/LogoutConfirm.tsx | 111 +++--- src/lib/components/Register.tsx | 281 ++++++++-------- src/lib/components/RegisterUserProfile.tsx | 125 +++---- src/lib/components/Terms.tsx | 108 +++--- src/lib/components/UpdateUserProfile.tsx | 125 +++---- src/lib/components/WebauthnAuthenticate.tsx | 353 ++++++++++---------- 22 files changed, 1856 insertions(+), 1779 deletions(-) diff --git a/src/lib/components/Error.tsx b/src/lib/components/Error.tsx index 298bff06..06fcee6b 100644 --- a/src/lib/components/Error.tsx +++ b/src/lib/components/Error.tsx @@ -1,40 +1,43 @@ import React, { memo } from "react"; -import Template from "./Template"; +import DefaultTemplate from "./Template"; +import type { TemplateProps } from "./Template"; import type { KcProps } from "./KcProps"; import type { KcContextBase } from "../getKcContext/KcContextBase"; import type { I18n } from "../i18n"; -const Error = memo( - ({ - kcContext, - i18n, - doFetchDefaultThemeResources = true, - ...props - }: { kcContext: KcContextBase.Error; i18n: I18n; doFetchDefaultThemeResources?: boolean } & KcProps) => { - const { message, client } = kcContext; +export type ErrorProps = KcProps & { + kcContext: KcContextBase.Error; + i18n: I18n; + doFetchDefaultThemeResources?: boolean; + Template?: (props: TemplateProps) => JSX.Element | null; +}; - const { msg } = i18n; +const Error = memo((props: ErrorProps) => { + const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props; - return ( -