Skip to content

Commit

Permalink
Refactor CreateNewOrgScreenBase and demo
Browse files Browse the repository at this point in the history
  • Loading branch information
daileytj committed Nov 17, 2023
1 parent 3afac2f commit ea8705b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ export const CreateNewOrgScreenBaseDemo: React.FC = () => (
WorkflowCardHeaderProps={{ title: 'Create An Organization' }}
WorkflowCardInstructionProps={{
instructions:
'Enter your organization name to continue with account creation. Fields marked with an (*) are required.',
'Enter your organization name to continue with account creation.',
}}
orgNameLabel="Organization Name"
orgNameTextFieldProps={{
required: true,
}}
orgNameValidator={(orgName: string): boolean | string => {
if (orgName?.length > 0) {
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React, { useCallback, useEffect } from 'react';
import { CreateNewOrgScreenProps } from './types';
import { WorkflowCard } from '../../components/WorkflowCard';
import { WorkflowCardActions } from '../../components/WorkflowCard/WorkflowCardActions';
import { WorkflowCardBody } from '../../components/WorkflowCard/WorkflowCardBody';
import { WorkflowCardHeader } from '../../components/WorkflowCard/WorkflowCardHeader';
import { WorkflowCardInstructions } from '../../components/WorkflowCard/WorkflowCardInstructions';
import TextField from '@mui/material/TextField';
import ErrorManager from '../../components/Error/ErrorManager';
import {
WorkflowCard,
WorkflowCardHeader,
WorkflowCardInstructions,
WorkflowCardBody,
WorkflowCardActions,
} from '../../components';

/**
* Component that renders a screen for the user to enter an organization name to start the
Expand Down Expand Up @@ -83,8 +85,7 @@ export const CreateNewOrgScreenBase: React.FC<React.PropsWithChildren<CreateNewO
helperText={shouldValidateOrgName && orgNameError}
{...orgNameTextFieldProps}
onChange={(e): void => {
// eslint-disable-next-line no-unused-expressions
orgNameTextFieldProps?.onChange && orgNameTextFieldProps.onChange(e);
orgNameTextFieldProps?.onChange?.(e);
handleOrgNameInputChange(e.target.value);
}}
onKeyUp={(e): void => {
Expand All @@ -95,8 +96,7 @@ export const CreateNewOrgScreenBase: React.FC<React.PropsWithChildren<CreateNewO
actionsProps?.onNext?.();
}}
onBlur={(e): void => {
// eslint-disable-next-line no-unused-expressions
orgNameTextFieldProps?.onBlur && orgNameTextFieldProps.onBlur(e);
orgNameTextFieldProps?.onBlur?.(e);
setShouldValidateOrgName(true);
}}
/>
Expand All @@ -105,7 +105,7 @@ export const CreateNewOrgScreenBase: React.FC<React.PropsWithChildren<CreateNewO
<WorkflowCardActions
{...actionsProps}
canGoNext={(orgNameInput.length > 0 && isOrgNameValid && actionsProps.canGoNext) as any}
></WorkflowCardActions>
/>
</WorkflowCard>
);
};

0 comments on commit ea8705b

Please sign in to comment.