From bbb690194c928a9af7a583abacb961435c159390 Mon Sep 17 00:00:00 2001 From: Jonni Date: Fri, 18 Oct 2024 13:21:25 +0000 Subject: [PATCH 1/2] fix: checkbox width bug --- .../src/forms/ExampleForm.ts | 49 ++++++++++++++++--- .../CheckboxFormField/CheckboxFormField.tsx | 7 ++- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/libs/application/templates/reference-template/src/forms/ExampleForm.ts b/libs/application/templates/reference-template/src/forms/ExampleForm.ts index ced834ba746a..82d64f8a090e 100644 --- a/libs/application/templates/reference-template/src/forms/ExampleForm.ts +++ b/libs/application/templates/reference-template/src/forms/ExampleForm.ts @@ -38,13 +38,48 @@ export const ExampleForm: Form = buildForm({ id: 'intro', title: m.introSection, children: [ - buildDescriptionField({ - id: 'field', - title: m.introField, - description: (application) => ({ - ...m.introIntroduction, - values: { name: application.answers.name }, - }), + buildMultiField({ + title: '', + children: [ + buildDescriptionField({ + id: 'field', + title: m.introField, + description: (application) => ({ + ...m.introIntroduction, + values: { name: application.answers.name }, + }), + }), + buildDescriptionField({ + id: 'field', + title: m.introField, + description: (application) => ({ + ...m.introIntroduction, + values: { name: application.answers.name }, + }), + }), + buildCheckboxField({ + id: 'field', + title: 'test checkbox', + options: [ + { value: 'test', label: 'test' }, + { value: 'test', label: 'test' }, + { value: 'test', label: 'test' }, + { value: 'test', label: 'test' }, + ], + width: 'half', + }), + buildCheckboxField({ + id: 'field', + title: 'test checkbox', + options: [ + { value: 'test', label: 'test' }, + { value: 'test', label: 'test' }, + { value: 'test', label: 'test' }, + { value: 'test', label: 'test' }, + ], + width: 'full', + }), + ], }), buildMultiField({ id: 'about', diff --git a/libs/application/ui-fields/src/lib/CheckboxFormField/CheckboxFormField.tsx b/libs/application/ui-fields/src/lib/CheckboxFormField/CheckboxFormField.tsx index 136d978de23a..32ac27632a3c 100644 --- a/libs/application/ui-fields/src/lib/CheckboxFormField/CheckboxFormField.tsx +++ b/libs/application/ui-fields/src/lib/CheckboxFormField/CheckboxFormField.tsx @@ -1,4 +1,4 @@ -import React, { FC, useMemo } from 'react' +import { useMemo } from 'react' import HtmlParser from 'react-html-parser' import { @@ -20,12 +20,12 @@ interface Props extends FieldBaseProps { field: CheckboxField } -export const CheckboxFormField: FC> = ({ +export const CheckboxFormField = ({ error, showFieldName = false, field, application, -}) => { +}: Props) => { const { id, title, @@ -68,7 +68,6 @@ export const CheckboxFormField: FC> = ({ large={large} name={`${id}`} onSelect={onSelect} - split={width === 'half' ? '1/2' : '1/1'} backgroundColor={backgroundColor} defaultValue={ ((getValueViaPath(application.answers, id) as string[]) ?? From 322cc33e8f074d06f524f931738cb4737e8f50c3 Mon Sep 17 00:00:00 2001 From: Jonni Date: Fri, 18 Oct 2024 13:26:05 +0000 Subject: [PATCH 2/2] chore: revert the example form --- .../src/forms/ExampleForm.ts | 49 +++---------------- 1 file changed, 7 insertions(+), 42 deletions(-) diff --git a/libs/application/templates/reference-template/src/forms/ExampleForm.ts b/libs/application/templates/reference-template/src/forms/ExampleForm.ts index 82d64f8a090e..ced834ba746a 100644 --- a/libs/application/templates/reference-template/src/forms/ExampleForm.ts +++ b/libs/application/templates/reference-template/src/forms/ExampleForm.ts @@ -38,48 +38,13 @@ export const ExampleForm: Form = buildForm({ id: 'intro', title: m.introSection, children: [ - buildMultiField({ - title: '', - children: [ - buildDescriptionField({ - id: 'field', - title: m.introField, - description: (application) => ({ - ...m.introIntroduction, - values: { name: application.answers.name }, - }), - }), - buildDescriptionField({ - id: 'field', - title: m.introField, - description: (application) => ({ - ...m.introIntroduction, - values: { name: application.answers.name }, - }), - }), - buildCheckboxField({ - id: 'field', - title: 'test checkbox', - options: [ - { value: 'test', label: 'test' }, - { value: 'test', label: 'test' }, - { value: 'test', label: 'test' }, - { value: 'test', label: 'test' }, - ], - width: 'half', - }), - buildCheckboxField({ - id: 'field', - title: 'test checkbox', - options: [ - { value: 'test', label: 'test' }, - { value: 'test', label: 'test' }, - { value: 'test', label: 'test' }, - { value: 'test', label: 'test' }, - ], - width: 'full', - }), - ], + buildDescriptionField({ + id: 'field', + title: m.introField, + description: (application) => ({ + ...m.introIntroduction, + values: { name: application.answers.name }, + }), }), buildMultiField({ id: 'about',