UNPKG

@brightlayer-ui/react-native-auth-workflow

Version:

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

39 lines (38 loc) 2.09 kB
import React from 'react'; import { WorkflowCard, WorkflowCardActions, WorkflowCardBody, WorkflowCardHeader } from '../../components/WorkflowCard'; import { EmptyState } from '@brightlayer-ui/react-native-components'; import { View, StyleSheet } from 'react-native'; const makeStyles = () => StyleSheet.create({ emptyStateContainer: { display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100%', }, }); /** * Component that renders a success screen * * @param {SuccessScreenProps} props - Basic props of Success Screen component * * @category Component */ export const SuccessScreenBase = (props) => { var _a, _b, _c, _d; const { dismissButtonLabel = '', canDismiss, onDismiss, EmptyStateProps } = props; const cardBaseProps = (_a = props.WorkflowCardBaseProps) !== null && _a !== void 0 ? _a : {}; const headerProps = (_b = props.WorkflowCardHeaderProps) !== null && _b !== void 0 ? _b : {}; const actionsProps = (_c = props.WorkflowCardActionsProps) !== null && _c !== void 0 ? _c : {}; const bodyProps = (_d = props.WorkflowCardBodyProps) !== null && _d !== void 0 ? _d : {}; const styles = makeStyles(); return (React.createElement(WorkflowCard, Object.assign({}, cardBaseProps), Object.keys(headerProps).length !== 0 && React.createElement(WorkflowCardHeader, Object.assign({}, headerProps)), React.createElement(WorkflowCardBody, Object.assign({ scrollable: false }, bodyProps), React.createElement(View, { style: [styles.emptyStateContainer] }, EmptyStateProps && React.createElement(EmptyState, Object.assign({}, EmptyStateProps)))), React.createElement(WorkflowCardActions, Object.assign({}, actionsProps, { nextLabel: dismissButtonLabel || actionsProps.nextLabel, canGoNext: canDismiss !== null && canDismiss !== void 0 ? canDismiss : actionsProps.canGoNext, onNext: () => { if (onDismiss) onDismiss(); if (actionsProps.onNext) actionsProps.onNext(); } })))); };