UNPKG

@brightlayer-ui/react-auth-workflow

Version:

Re-usable workflow components for Authentication and Registration within Eaton applications.

40 lines (39 loc) 1.82 kB
import React from 'react'; import Person from '@mui/icons-material/Person'; import { useRegistrationContext } from '../../contexts/index.js'; import { SuccessScreenBase } from '../SuccessScreen/index.js'; import { useTranslation } from 'react-i18next'; /** * Full Screen component that renders a Success Screen for the accounts which are already exists in the records * * @param {SuccessScreenProps} props - props of SuccessScreen * * @category Component */ export const ExistingAccountSuccessScreen = (props) => { const { t } = useTranslation(); const { navigate, routeConfig } = useRegistrationContext(); const { canDismiss = true, onDismiss = () => navigate(routeConfig.LOGIN), WorkflowCardHeaderProps, WorkflowCardActionsProps, EmptyStateProps, ...otherExistingAccountSuccessScreenProps } = props; const workflowCardHeaderProps = { title: t('bluiRegistration:REGISTRATION.STEPS.COMPLETE'), ...WorkflowCardHeaderProps, }; const workflowCardActionsProps = { nextLabel: t('bluiCommon:ACTIONS.CONTINUE'), showNext: true, canGoNext: canDismiss, fullWidthButton: true, ...WorkflowCardActionsProps, onNext: () => { onDismiss(); WorkflowCardActionsProps?.onNext?.(); }, }; const emptyStateProps = { icon: React.createElement(Person, { color: 'primary', sx: { fontSize: 100, mb: 2 } }), title: t('bluiCommon:MESSAGES.WELCOME'), description: t('bluiRegistration:REGISTRATION.SUCCESS_EXISTING'), ...EmptyStateProps, }; return (React.createElement(SuccessScreenBase, { WorkflowCardHeaderProps: workflowCardHeaderProps, WorkflowCardActionsProps: workflowCardActionsProps, EmptyStateProps: emptyStateProps, ...otherExistingAccountSuccessScreenProps })); };