From 8d13bac023c9fea9548b58fc26ef5e6fa1ccdcdb Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Tue, 5 Mar 2024 11:16:48 -0500 Subject: [PATCH 1/7] Error manager translate dismissLabel for dialog --- login-workflow/src/components/Error/ErrorManager.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/login-workflow/src/components/Error/ErrorManager.tsx b/login-workflow/src/components/Error/ErrorManager.tsx index 343c5946..706eee90 100644 --- a/login-workflow/src/components/Error/ErrorManager.tsx +++ b/login-workflow/src/components/Error/ErrorManager.tsx @@ -17,6 +17,11 @@ export type ErrorManagerProps = { */ title?: string; + /** + * The label on the dismiss button in dialog mode + */ + dismissLabel?: string; + /** * The function to call when the close/dismiss button is clicked * @returns void @@ -31,7 +36,7 @@ export type ErrorManagerProps = { /** * Configuration options when using mode='dialog' * @param {string} dialogConfig.title - The title used in the dialog header - * @param {string} dialogConfig.dismissLabel - The label on the dismiss button. + * @param {string} dialogConfig.dismissLabel - The label on the dismiss button in dialog mode. */ dialogConfig?: { dismissLabel?: string; @@ -76,6 +81,7 @@ const ErrorManager: React.FC = (props): JSX.Element => { mode = 'dialog', title, error = '', + dismissLabel, onClose = (): void => {}, dialogConfig, messageBoxConfig = { @@ -90,7 +96,7 @@ const ErrorManager: React.FC = (props): JSX.Element => { title={dialogConfig?.title ?? title ?? t('bluiCommon:MESSAGES.ERROR')} body={t(error)} onClose={onClose} - dismissButtonText={dialogConfig?.dismissLabel} + dismissButtonText={dialogConfig?.dismissLabel ?? dismissLabel ?? t('bluiCommon:ACTIONS.OKAY')} sx={dialogConfig?.sx} /> ), From ec39c8e5c72fa690e90970775989e04dac63f010 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Tue, 5 Mar 2024 11:18:32 -0500 Subject: [PATCH 2/7] lint prettier --- login-workflow/src/components/Error/ErrorManager.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/login-workflow/src/components/Error/ErrorManager.tsx b/login-workflow/src/components/Error/ErrorManager.tsx index 706eee90..7272c2b8 100644 --- a/login-workflow/src/components/Error/ErrorManager.tsx +++ b/login-workflow/src/components/Error/ErrorManager.tsx @@ -100,7 +100,7 @@ const ErrorManager: React.FC = (props): JSX.Element => { sx={dialogConfig?.sx} /> ), - [dialogConfig, title, error, onClose, t] + [dialogConfig, dismissLabel, title, error, onClose, t] ); const ErrorMessageBoxWithProps = useCallback((): JSX.Element => { From a4234c83ae3dc6a759d2a7002f0cbcc136233b04 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Wed, 6 Mar 2024 13:04:46 -0500 Subject: [PATCH 3/7] merge props and update providers --- .../example/src/actions/AuthUIActions.tsx | 2 +- login-workflow/example/src/screens/Login.tsx | 2 +- .../src/components/Error/ErrorManager.tsx | 22 ++++------ .../RegistrationWorkflow.tsx | 39 ++++++++++-------- .../src/contexts/AuthContext/provider.tsx | 41 +++++++++++++++---- .../contexts/RegistrationContext/provider.tsx | 36 +++++++++++++--- 6 files changed, 95 insertions(+), 47 deletions(-) diff --git a/login-workflow/example/src/actions/AuthUIActions.tsx b/login-workflow/example/src/actions/AuthUIActions.tsx index f55036d9..5bb1a892 100644 --- a/login-workflow/example/src/actions/AuthUIActions.tsx +++ b/login-workflow/example/src/actions/AuthUIActions.tsx @@ -11,7 +11,7 @@ function getRandomInt(max: number): number { function isRandomFailure(): boolean { const randomResponseNumber = getRandomInt(100); - return false; // randomResponseNumber < 10; + return true; // randomResponseNumber < 10; } type AuthUIActionsWithApp = (appHelper: AppContextType) => AuthUIActions; diff --git a/login-workflow/example/src/screens/Login.tsx b/login-workflow/example/src/screens/Login.tsx index 9f3b31fe..8b4364fa 100644 --- a/login-workflow/example/src/screens/Login.tsx +++ b/login-workflow/example/src/screens/Login.tsx @@ -9,7 +9,7 @@ export const Login = (): JSX.Element => ( projectImage={logo} header={} errorDisplayConfig={{ - mode: 'message-box', + mode: 'dialog', messageBoxConfig: { dismissible: true, position: 'top', diff --git a/login-workflow/src/components/Error/ErrorManager.tsx b/login-workflow/src/components/Error/ErrorManager.tsx index 7272c2b8..e43ee0f7 100644 --- a/login-workflow/src/components/Error/ErrorManager.tsx +++ b/login-workflow/src/components/Error/ErrorManager.tsx @@ -2,7 +2,6 @@ import React, { useCallback } from 'react'; import { BasicDialog } from '../Dialog/BasicDialog'; import ErrorMessageBox from './ErrorMessageBox'; import { SxProps, Theme } from '@mui/material/styles'; -import { useTranslation } from 'react-i18next'; export type AuthError = { cause: { title: string; errorMessage: string } }; @@ -17,11 +16,6 @@ export type ErrorManagerProps = { */ title?: string; - /** - * The label on the dismiss button in dialog mode - */ - dismissLabel?: string; - /** * The function to call when the close/dismiss button is clicked * @returns void @@ -75,13 +69,11 @@ export type ErrorManagerProps = { */ const ErrorManager: React.FC = (props): JSX.Element => { - const { t } = useTranslation(); const { children, mode = 'dialog', title, error = '', - dismissLabel, onClose = (): void => {}, dialogConfig, messageBoxConfig = { @@ -93,14 +85,14 @@ const ErrorManager: React.FC = (props): JSX.Element => { (): JSX.Element => ( 0} - title={dialogConfig?.title ?? title ?? t('bluiCommon:MESSAGES.ERROR')} - body={t(error)} + title={dialogConfig?.title ?? title ?? 'Error' } + body={(error)} onClose={onClose} - dismissButtonText={dialogConfig?.dismissLabel ?? dismissLabel ?? t('bluiCommon:ACTIONS.OKAY')} + dismissButtonText={dialogConfig?.dismissLabel ?? 'Okay'} sx={dialogConfig?.sx} /> ), - [dialogConfig, dismissLabel, title, error, onClose, t] + [dialogConfig, title, error, onClose] ); const ErrorMessageBoxWithProps = useCallback((): JSX.Element => { @@ -108,8 +100,8 @@ const ErrorManager: React.FC = (props): JSX.Element => { return ( = (props): JSX.Element => { onClose={onClose} /> ); - }, [error, title, t, messageBoxConfig, onClose]); + }, [error, title, messageBoxConfig, onClose]); return mode === 'dialog' && error.length > 0 ? ( <> diff --git a/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx b/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx index 35a28821..ae27179d 100644 --- a/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx +++ b/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx @@ -54,17 +54,24 @@ export type RegistrationWorkflowProps = { }; export const RegistrationWorkflow: React.FC> = (props) => { + const { errorDisplayConfig: registrationWorkflowErrorConfig } = props; const [isAccountExist, setIsAccountExist] = useState(false); - const { triggerError, errorManagerConfig } = useErrorManager(); + const { triggerError, errorManagerConfig: globalErrorManagerConfig } = useErrorManager(); const { actions, navigate } = useRegistrationContext(); + const { messageBoxConfig: workflowMessageBoxConfig, dialogConfig: workflowDialogConfig, onClose:workflowOnClose, ...otherWorkflowErrorConfig } = registrationWorkflowErrorConfig ?? {}; + const { messageBoxConfig: globalMessageBoxConfig, dialogConfig: globalDialogConfig, onClose:globalOnClose, ...otherGlobalErrorConfig } = globalErrorManagerConfig; - const errorDisplayConfig = { - ...errorManagerConfig, - ...props.errorDisplayConfig, + + const errorDisplayConfig: ErrorManagerProps = { + messageBoxConfig: { ...globalMessageBoxConfig, ...workflowMessageBoxConfig }, + dialogConfig: { ...globalDialogConfig, ...workflowDialogConfig }, onClose: (): void => { - if (props.errorDisplayConfig && props.errorDisplayConfig.onClose) props.errorDisplayConfig.onClose(); - if (errorManagerConfig.onClose) errorManagerConfig?.onClose(); + workflowOnClose?.(); + globalOnClose?.(); }, + + ...otherGlobalErrorConfig, + ...otherWorkflowErrorConfig, }; const { initialScreenIndex = 0, @@ -73,17 +80,17 @@ export const RegistrationWorkflow: React.FC, - , - , - ] + , + , + , + ] : [ - , - , - , - , - , - ], + , + , + , + , + , + ], } = props; const screens = [...(Array.isArray(children) ? children : [children])]; diff --git a/login-workflow/src/contexts/AuthContext/provider.tsx b/login-workflow/src/contexts/AuthContext/provider.tsx index 296a5383..9b8ad5a8 100644 --- a/login-workflow/src/contexts/AuthContext/provider.tsx +++ b/login-workflow/src/contexts/AuthContext/provider.tsx @@ -6,20 +6,18 @@ import React, { useEffect } from 'react'; import { AuthContextProviderProps } from './types'; import { AuthContext } from './context'; -import { I18nextProvider } from 'react-i18next'; +import { I18nextProvider, useTranslation } from 'react-i18next'; import { i18nAuthInstance } from './i18nAuthInstance'; import { ErrorContext } from '../ErrorContext'; import { AuthDictionaries } from './AuthDictionaries'; import { SharedDictionaries } from '../SharedDictionaries'; +import { ErrorManagerProps } from '../../components/Error'; export const AuthContextProvider: React.FC< React.PropsWithChildren > = (props) => { const i18nInstance = props.i18n ?? i18nAuthInstance; - - const { children, ...authContextProps } = props; - - const { language, i18n = i18nInstance, errorConfig } = props; + const { language, i18n = i18nInstance, children, ...other } = props; if (props.i18n) { i18n.addResourceBundle('zh', 'bluiAuth', AuthDictionaries.chinese.translation, true, false); @@ -40,9 +38,36 @@ export const AuthContextProvider: React.FC< return ( - - {children} - + {children} ); }; + +const AuthContextProviderContent: React.FC< + React.PropsWithChildren & { PasswordDialog?: JSX.Element }> +> = (props) => { + const { children, errorConfig, ...authContextProps } = props; + const { t } = useTranslation(); + const mergedErrorConfig: ErrorManagerProps = { + title: t('bluiCommon:MESSAGES.ERROR'), + error: t('bluiAuth:LOGIN.INVALID_CREDENTIALS'), + ...errorConfig, + dialogConfig: { + dismissLabel:t('bluiCommon:ACTIONS.OKAY'), + ...errorConfig?.dialogConfig ?? {}, + } + } + + return ( + + {children} + + ); +}; + + diff --git a/login-workflow/src/contexts/RegistrationContext/provider.tsx b/login-workflow/src/contexts/RegistrationContext/provider.tsx index d8be7ed9..ed50a6f2 100644 --- a/login-workflow/src/contexts/RegistrationContext/provider.tsx +++ b/login-workflow/src/contexts/RegistrationContext/provider.tsx @@ -6,18 +6,18 @@ import React, { useEffect } from 'react'; import { RegistrationContextProviderProps } from './types'; import { RegistrationContext } from './context'; -import { I18nextProvider } from 'react-i18next'; +import { I18nextProvider, useTranslation } from 'react-i18next'; import { i18nRegistrationInstance } from './i18nRegistrationInstance'; import { ErrorContext } from '../ErrorContext'; import { SharedDictionaries } from '../SharedDictionaries'; import { RegistrationDictionaries } from './RegistrationDictionaries'; +import { ErrorManagerProps } from '../../components/Error'; export const RegistrationContextProvider: React.FC> = ( props ) => { const i18nInstance = props.i18n ?? i18nRegistrationInstance; - const { children, ...registrationContextProps } = props; - const { language, i18n = i18nInstance, errorConfig } = props; + const { language, i18n = i18nInstance, children, ...other } = props; if (props.i18n) { i18n.addResourceBundle('zh', 'bluiRegistration', RegistrationDictionaries.chinese.translation, true, false); @@ -38,9 +38,33 @@ export const RegistrationContextProvider: React.FC - - {children} - + {children} ); }; + +const RegistrationContextProviderContent: React.FC< + React.PropsWithChildren & { PasswordDialog?: JSX.Element }> +> = (props) => { + const { children, errorConfig, ...registrationContextProps } = props; + const { t } = useTranslation(); + const mergedErrorConfig: ErrorManagerProps = { + title: t('bluiCommon:MESSAGES.ERROR'), + ...errorConfig, + dialogConfig: { + dismissLabel: t('bluiCommon:ACTIONS.OKAY'), + ...errorConfig?.dialogConfig ?? {}, + } + } + + + return ( + + {children} + + ); +}; From 44a99913656a5a0637ead28f8213c9d32c38d848 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Thu, 7 Mar 2024 13:21:06 -0500 Subject: [PATCH 4/7] update providers & add t function prop --- .../docs/components/error-manager.md | 1 + .../src/components/Error/ErrorManager.tsx | 22 +++++--- .../RegistrationWorkflow.tsx | 35 +++++++----- .../src/contexts/AuthContext/provider.tsx | 56 +++++++++---------- .../contexts/RegistrationContext/provider.tsx | 54 +++++++++--------- .../ForgotPasswordScreen.tsx | 1 + 6 files changed, 91 insertions(+), 78 deletions(-) diff --git a/login-workflow/docs/components/error-manager.md b/login-workflow/docs/components/error-manager.md index 5d1f4e97..793693e5 100644 --- a/login-workflow/docs/components/error-manager.md +++ b/login-workflow/docs/components/error-manager.md @@ -27,6 +27,7 @@ import { ErrorManager } from '@brightlayer-ui/react-auth-workflow'; | onClose | `() => void` | Function to call when the close/dismiss button is clicked. | | | dialogConfig | `{title?: string, dismissLabel?: string}` | Configuration options for the dialog. See [DialogConfig Props](#dialogconfigprops) | | | messageBoxConfig | `MessageBoxProps` | Configuration options for the message box. See [MessageBoxProps](#messageboxprops) | | +| t | `TFunction \| ((key: string) => string)` | Translate function to translate error related text. | | | children | `ReactNode` | Message box errors will appear before or after content passed as children. | | ### DialogConfigProps diff --git a/login-workflow/src/components/Error/ErrorManager.tsx b/login-workflow/src/components/Error/ErrorManager.tsx index e43ee0f7..d8eac38c 100644 --- a/login-workflow/src/components/Error/ErrorManager.tsx +++ b/login-workflow/src/components/Error/ErrorManager.tsx @@ -2,6 +2,7 @@ import React, { useCallback } from 'react'; import { BasicDialog } from '../Dialog/BasicDialog'; import ErrorMessageBox from './ErrorMessageBox'; import { SxProps, Theme } from '@mui/material/styles'; +import { TFunction } from 'i18next'; export type AuthError = { cause: { title: string; errorMessage: string } }; @@ -27,6 +28,12 @@ export type ErrorManagerProps = { */ error?: string; + /** + * Translate function to translate error related text + */ + + t?: TFunction | ((key: string) => string); + /** * Configuration options when using mode='dialog' * @param {string} dialogConfig.title - The title used in the dialog header @@ -76,6 +83,7 @@ const ErrorManager: React.FC = (props): JSX.Element => { error = '', onClose = (): void => {}, dialogConfig, + t = (key: string): string => key, messageBoxConfig = { position: 'top', }, @@ -85,14 +93,14 @@ const ErrorManager: React.FC = (props): JSX.Element => { (): JSX.Element => ( 0} - title={dialogConfig?.title ?? title ?? 'Error' } - body={(error)} + title={t(dialogConfig?.title ?? title ?? 'Error')} + body={t(error)} onClose={onClose} - dismissButtonText={dialogConfig?.dismissLabel ?? 'Okay'} + dismissButtonText={t(dialogConfig?.dismissLabel ?? 'Okay')} sx={dialogConfig?.sx} /> ), - [dialogConfig, title, error, onClose] + [dialogConfig, title, error, onClose, t] ); const ErrorMessageBoxWithProps = useCallback((): JSX.Element => { @@ -100,8 +108,8 @@ const ErrorManager: React.FC = (props): JSX.Element => { return ( = (props): JSX.Element => { onClose={onClose} /> ); - }, [error, title, messageBoxConfig, onClose]); + }, [error, title, messageBoxConfig, onClose, t]); return mode === 'dialog' && error.length > 0 ? ( <> diff --git a/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx b/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx index ae27179d..93f9e2f6 100644 --- a/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx +++ b/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx @@ -58,9 +58,18 @@ export const RegistrationWorkflow: React.FC, - , - , - ] + , + , + , + ] : [ - , - , - , - , - , - ], + , + , + , + , + , + ], } = props; const screens = [...(Array.isArray(children) ? children : [children])]; diff --git a/login-workflow/src/contexts/AuthContext/provider.tsx b/login-workflow/src/contexts/AuthContext/provider.tsx index 9b8ad5a8..dfa21e64 100644 --- a/login-workflow/src/contexts/AuthContext/provider.tsx +++ b/login-workflow/src/contexts/AuthContext/provider.tsx @@ -13,6 +13,29 @@ import { AuthDictionaries } from './AuthDictionaries'; import { SharedDictionaries } from '../SharedDictionaries'; import { ErrorManagerProps } from '../../components/Error'; +const AuthContextProviderContent: React.FC< + React.PropsWithChildren & { PasswordDialog?: JSX.Element }> +> = (props) => { + const { children, errorConfig, ...authContextProps } = props; + const { t } = useTranslation(); + const mergedErrorConfig: ErrorManagerProps = { + t: t, + title: 'bluiCommon:MESSAGES.ERROR', + error: 'bluiAuth:LOGIN.INVALID_CREDENTIALS', + ...errorConfig, + dialogConfig: { + dismissLabel: 'bluiCommon:ACTIONS.OKAY', + ...(errorConfig?.dialogConfig ?? {}), + }, + }; + + return ( + + {children} + + ); +}; + export const AuthContextProvider: React.FC< React.PropsWithChildren > = (props) => { @@ -38,36 +61,9 @@ export const AuthContextProvider: React.FC< return ( - {children} + + {children} + ); }; - -const AuthContextProviderContent: React.FC< - React.PropsWithChildren & { PasswordDialog?: JSX.Element }> -> = (props) => { - const { children, errorConfig, ...authContextProps } = props; - const { t } = useTranslation(); - const mergedErrorConfig: ErrorManagerProps = { - title: t('bluiCommon:MESSAGES.ERROR'), - error: t('bluiAuth:LOGIN.INVALID_CREDENTIALS'), - ...errorConfig, - dialogConfig: { - dismissLabel:t('bluiCommon:ACTIONS.OKAY'), - ...errorConfig?.dialogConfig ?? {}, - } - } - - return ( - - {children} - - ); -}; - - diff --git a/login-workflow/src/contexts/RegistrationContext/provider.tsx b/login-workflow/src/contexts/RegistrationContext/provider.tsx index ed50a6f2..11a45783 100644 --- a/login-workflow/src/contexts/RegistrationContext/provider.tsx +++ b/login-workflow/src/contexts/RegistrationContext/provider.tsx @@ -1,6 +1,6 @@ /** * @packageDocumentation - * @module RegistrationWorkflowContextProvider + * @module RegistrationContextProvider */ import React, { useEffect } from 'react'; @@ -13,6 +13,28 @@ import { SharedDictionaries } from '../SharedDictionaries'; import { RegistrationDictionaries } from './RegistrationDictionaries'; import { ErrorManagerProps } from '../../components/Error'; +const RegistrationContextProviderContent: React.FC< + React.PropsWithChildren> +> = (props) => { + const { children, errorConfig, ...registrationContextProps } = props; + const { t } = useTranslation(); + const mergedErrorConfig: ErrorManagerProps = { + t: t, + title: 'bluiCommon:MESSAGES.ERROR', + ...errorConfig, + dialogConfig: { + dismissLabel: 'bluiCommon:ACTIONS.OKAY', + ...(errorConfig?.dialogConfig ?? {}), + }, + }; + + return ( + + {children} + + ); +}; + export const RegistrationContextProvider: React.FC> = ( props ) => { @@ -38,33 +60,9 @@ export const RegistrationContextProvider: React.FC - {children} + + {children} + ); }; - -const RegistrationContextProviderContent: React.FC< - React.PropsWithChildren & { PasswordDialog?: JSX.Element }> -> = (props) => { - const { children, errorConfig, ...registrationContextProps } = props; - const { t } = useTranslation(); - const mergedErrorConfig: ErrorManagerProps = { - title: t('bluiCommon:MESSAGES.ERROR'), - ...errorConfig, - dialogConfig: { - dismissLabel: t('bluiCommon:ACTIONS.OKAY'), - ...errorConfig?.dialogConfig ?? {}, - } - } - - - return ( - - {children} - - ); -}; diff --git a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx index 83707e0b..add83a7f 100644 --- a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx +++ b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx @@ -63,6 +63,7 @@ export const ForgotPasswordScreen: React.FC = (props) setIsLoading(false); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [actions, triggerError] ); From 838119826373cda81a2e3c83ed54ef52e49c5153 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Thu, 7 Mar 2024 13:27:44 -0500 Subject: [PATCH 5/7] revert action failure --- login-workflow/example/src/actions/AuthUIActions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/login-workflow/example/src/actions/AuthUIActions.tsx b/login-workflow/example/src/actions/AuthUIActions.tsx index 5bb1a892..f55036d9 100644 --- a/login-workflow/example/src/actions/AuthUIActions.tsx +++ b/login-workflow/example/src/actions/AuthUIActions.tsx @@ -11,7 +11,7 @@ function getRandomInt(max: number): number { function isRandomFailure(): boolean { const randomResponseNumber = getRandomInt(100); - return true; // randomResponseNumber < 10; + return false; // randomResponseNumber < 10; } type AuthUIActionsWithApp = (appHelper: AppContextType) => AuthUIActions; From fab13c0acd9114b9c7140d74723dcc73939aa70f Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Thu, 7 Mar 2024 13:36:24 -0500 Subject: [PATCH 6/7] revert to default message-box in example --- login-workflow/example/src/screens/Login.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/login-workflow/example/src/screens/Login.tsx b/login-workflow/example/src/screens/Login.tsx index 8b4364fa..9f3b31fe 100644 --- a/login-workflow/example/src/screens/Login.tsx +++ b/login-workflow/example/src/screens/Login.tsx @@ -9,7 +9,7 @@ export const Login = (): JSX.Element => ( projectImage={logo} header={} errorDisplayConfig={{ - mode: 'dialog', + mode: 'message-box', messageBoxConfig: { dismissible: true, position: 'top', From 7dd2edbb3d7672c059ac2fbca5b84768f867e696 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Thu, 7 Mar 2024 15:03:29 -0500 Subject: [PATCH 7/7] update TFunction prop & docs --- login-workflow/docs/components/error-manager.md | 2 +- login-workflow/src/components/Error/ErrorManager.tsx | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/login-workflow/docs/components/error-manager.md b/login-workflow/docs/components/error-manager.md index 793693e5..6bd61549 100644 --- a/login-workflow/docs/components/error-manager.md +++ b/login-workflow/docs/components/error-manager.md @@ -27,7 +27,7 @@ import { ErrorManager } from '@brightlayer-ui/react-auth-workflow'; | onClose | `() => void` | Function to call when the close/dismiss button is clicked. | | | dialogConfig | `{title?: string, dismissLabel?: string}` | Configuration options for the dialog. See [DialogConfig Props](#dialogconfigprops) | | | messageBoxConfig | `MessageBoxProps` | Configuration options for the message box. See [MessageBoxProps](#messageboxprops) | | -| t | `TFunction \| ((key: string) => string)` | Translate function to translate error related text. | | +| t | `TFunction` | Translate function to translate error related text. | | | children | `ReactNode` | Message box errors will appear before or after content passed as children. | | ### DialogConfigProps diff --git a/login-workflow/src/components/Error/ErrorManager.tsx b/login-workflow/src/components/Error/ErrorManager.tsx index d8eac38c..14b4957f 100644 --- a/login-workflow/src/components/Error/ErrorManager.tsx +++ b/login-workflow/src/components/Error/ErrorManager.tsx @@ -31,8 +31,7 @@ export type ErrorManagerProps = { /** * Translate function to translate error related text */ - - t?: TFunction | ((key: string) => string); + t?: TFunction; /** * Configuration options when using mode='dialog'