diff --git a/src/Components/CreateImageWizard/ValidatedTextInput.tsx b/src/Components/CreateImageWizard/ValidatedInput.tsx similarity index 68% rename from src/Components/CreateImageWizard/ValidatedTextInput.tsx rename to src/Components/CreateImageWizard/ValidatedInput.tsx index 1379d141e..7aa999c40 100644 --- a/src/Components/CreateImageWizard/ValidatedTextInput.tsx +++ b/src/Components/CreateImageWizard/ValidatedInput.tsx @@ -3,6 +3,8 @@ import React, { useState } from 'react'; import { HelperText, HelperTextItem, + TextArea, + TextAreaProps, TextInput, TextInputProps, } from '@patternfly/react-core'; @@ -19,16 +21,18 @@ interface ValidatedTextInputPropTypes extends TextInputProps { placeholder?: string; } -interface HookValidatedTextInputPropTypes extends TextInputProps { - dataTestId?: string | undefined; - ouiaId?: string; - ariaLabel: string | undefined; - value: string; - placeholder?: string; - stepValidation: StepValidation; - fieldName: string; - warning?: string; -} +type HookValidatedInputPropTypes = TextInputProps & + TextAreaProps & { + dataTestId?: string | undefined; + ouiaId?: string; + ariaLabel: string | undefined; + value: string; + placeholder?: string; + stepValidation: StepValidation; + fieldName: string; + warning?: string; + inputType?: 'textInput' | 'textArea'; + }; export const HookValidatedInput = ({ dataTestId, @@ -41,8 +45,9 @@ export const HookValidatedInput = ({ stepValidation, fieldName, type = 'text', + inputType, warning = undefined, -}: HookValidatedTextInputPropTypes) => { +}: HookValidatedInputPropTypes) => { const [isPristine, setIsPristine] = useState(!value ? true : false); // Do not surface validation on pristine state components // Allow step validation to be set on pristine state, when needed @@ -60,18 +65,31 @@ export const HookValidatedInput = ({ return ( <> - + {inputType === 'textArea' ? ( +