Skip to content

Commit

Permalink
Use the correct component for field of type text
Browse files Browse the repository at this point in the history
Depending on `multiline`.
  • Loading branch information
jamesricky committed Feb 15, 2024
1 parent 0ba88ac commit 399214d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/admin/cms-admin/src/generator/future/generateForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export function generateForm(
FinalFormSubmitEvent,
Loading,
MainContent,
TextAreaField,
TextField,
Toolbar,
ToolbarActions,
ToolbarFillSpace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ export function generateFormField(
const imports: Imports = [];
let code = "";
if (config.type == "text") {
const TextInputComponent = config.multiline ? "TextAreaField" : "TextField";
code = `
<Field
<${TextInputComponent}
${required ? "required" : ""}
${config.multiline ? "multiline" : ""}
fullWidth
name="${name}"
component={FinalFormInput}
label={<FormattedMessage id="${instanceGqlType}.${name}" defaultMessage="${label}" />}
/>`;
} else if (config.type == "number") {
Expand Down

0 comments on commit 399214d

Please sign in to comment.