Skip to content

Commit 9fe3971

Browse files
committed
task: [InputEntry] Propagate fallbackValue to underlying DisplayField
1 parent c7df96b commit 9fe3971

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/components/InputEntry.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import { Element } from 'react-scroll';
55

66
import InputErrorMessage from 'components/InputErrorMessage';
77
import LabelOptional from 'components/LabelOptional';
8-
import { Heading } from 'design-system-react';
98
import { TextInput } from 'components/TextInput';
10-
import { DisplayField } from 'pages/Filing/ViewInstitutionProfile/DisplayField';
9+
import { Heading } from 'design-system-react';
1110
import type { InputType } from 'design-system-react/dist/components/TextInput/TextInput';
11+
import type { DisplayFieldProperties } from 'pages/Filing/ViewInstitutionProfile/DisplayField';
12+
import { DisplayField } from 'pages/Filing/ViewInstitutionProfile/DisplayField';
1213

1314
interface InputEntryProperties extends ComponentPropsWithoutRef<'input'> {
1415
id: string;
@@ -24,7 +25,10 @@ interface InputEntryProperties extends ComponentPropsWithoutRef<'input'> {
2425
helperText?: string;
2526
}
2627

27-
const InputEntry = forwardRef<HTMLInputElement, InputEntryProperties>(
28+
const InputEntry = forwardRef<
29+
HTMLInputElement,
30+
DisplayFieldProperties & InputEntryProperties
31+
>(
2832
(
2933
{
3034
className = '',
@@ -40,6 +44,7 @@ const InputEntry = forwardRef<HTMLInputElement, InputEntryProperties>(
4044
isOptional = false,
4145
type = 'text',
4246
helperText,
47+
fallbackValue,
4348
...properties
4449
},
4550
reference,
@@ -78,7 +83,13 @@ const InputEntry = forwardRef<HTMLInputElement, InputEntryProperties>(
7883
/>
7984
</>
8085
)}
81-
{hideInput ? <DisplayField label={label} value={children} /> : null}
86+
{hideInput ? (
87+
<DisplayField
88+
label={label}
89+
value={children}
90+
fallbackValue={fallbackValue}
91+
/>
92+
) : null}
8293
{handleError ? (
8394
<div>
8495
<InputErrorMessage>{errorMessage}</InputErrorMessage>

0 commit comments

Comments
 (0)