Skip to content

Commit

Permalink
task: [InputEntry] Propagate fallbackValue to underlying DisplayField
Browse files Browse the repository at this point in the history
  • Loading branch information
meissadia committed Oct 28, 2024
1 parent c7df96b commit 9fe3971
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/components/InputEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { Element } from 'react-scroll';

import InputErrorMessage from 'components/InputErrorMessage';
import LabelOptional from 'components/LabelOptional';
import { Heading } from 'design-system-react';
import { TextInput } from 'components/TextInput';
import { DisplayField } from 'pages/Filing/ViewInstitutionProfile/DisplayField';
import { Heading } from 'design-system-react';
import type { InputType } from 'design-system-react/dist/components/TextInput/TextInput';
import type { DisplayFieldProperties } from 'pages/Filing/ViewInstitutionProfile/DisplayField';
import { DisplayField } from 'pages/Filing/ViewInstitutionProfile/DisplayField';

interface InputEntryProperties extends ComponentPropsWithoutRef<'input'> {
id: string;
Expand All @@ -24,7 +25,10 @@ interface InputEntryProperties extends ComponentPropsWithoutRef<'input'> {
helperText?: string;
}

const InputEntry = forwardRef<HTMLInputElement, InputEntryProperties>(
const InputEntry = forwardRef<
HTMLInputElement,
DisplayFieldProperties & InputEntryProperties
>(
(
{
className = '',
Expand All @@ -40,6 +44,7 @@ const InputEntry = forwardRef<HTMLInputElement, InputEntryProperties>(
isOptional = false,
type = 'text',
helperText,
fallbackValue,
...properties
},
reference,
Expand Down Expand Up @@ -78,7 +83,13 @@ const InputEntry = forwardRef<HTMLInputElement, InputEntryProperties>(
/>
</>
)}
{hideInput ? <DisplayField label={label} value={children} /> : null}
{hideInput ? (
<DisplayField
label={label}
value={children}
fallbackValue={fallbackValue}
/>
) : null}
{handleError ? (
<div>
<InputErrorMessage>{errorMessage}</InputErrorMessage>
Expand Down

0 comments on commit 9fe3971

Please sign in to comment.