From 22338db960a9a734a44d9cb7f933e97c43354f0a Mon Sep 17 00:00:00 2001 From: Mark Youngman Date: Tue, 31 Dec 2024 15:46:13 +0000 Subject: [PATCH] EES-5758 Update data block table title limit to 220 chars --- .../Requests/DataBlockRequests.cs | 4 ++-- .../components/DataBlockDetailsForm.tsx | 24 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/GovUk.Education.ExploreEducationStatistics.Admin/Requests/DataBlockRequests.cs b/src/GovUk.Education.ExploreEducationStatistics.Admin/Requests/DataBlockRequests.cs index d81e49514c..37b38fde28 100644 --- a/src/GovUk.Education.ExploreEducationStatistics.Admin/Requests/DataBlockRequests.cs +++ b/src/GovUk.Education.ExploreEducationStatistics.Admin/Requests/DataBlockRequests.cs @@ -27,7 +27,7 @@ public Validator() { RuleFor(request => request.Heading) .NotEmpty() - .MaximumLength(120); + .MaximumLength(220); RuleFor(request => request.Name) .NotEmpty(); @@ -58,7 +58,7 @@ public Validator() { RuleFor(request => request.Heading) .NotEmpty() - .MaximumLength(120); + .MaximumLength(220); RuleFor(request => request.Name) .NotEmpty(); diff --git a/src/explore-education-statistics-admin/src/pages/release/datablocks/components/DataBlockDetailsForm.tsx b/src/explore-education-statistics-admin/src/pages/release/datablocks/components/DataBlockDetailsForm.tsx index bc0ba0fa6c..6173b5b6f5 100644 --- a/src/explore-education-statistics-admin/src/pages/release/datablocks/components/DataBlockDetailsForm.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/datablocks/components/DataBlockDetailsForm.tsx @@ -21,8 +21,10 @@ interface FormValues { export type DataBlockDetailsFormValues = OmitStrict; -const titleMaxLength = 120; -const descriptionMaxLength = 200; +const dataBlockTableTitleMaxLength = 220; +const featuredTableNameMaxLength = 120; +const featuredTableDescriptionMaxLength = 200; + const formId = 'dataBlockDetailsForm'; interface Props { @@ -61,8 +63,8 @@ const DataBlockDetailsForm = ({ heading: Yup.string() .required('Enter a table title') .max( - titleMaxLength, - `Table title must be ${titleMaxLength} characters or less`, + dataBlockTableTitleMaxLength, + `Table title must be ${dataBlockTableTitleMaxLength} characters or less`, ), source: Yup.string(), highlightName: Yup.string().when('isHighlight', { @@ -71,8 +73,8 @@ const DataBlockDetailsForm = ({ s .required('Enter a featured table name') .max( - titleMaxLength, - `Featured table name must be ${titleMaxLength} characters or less`, + featuredTableNameMaxLength, + `Featured table name must be ${featuredTableNameMaxLength} characters or less`, ), }), highlightDescription: Yup.string().when('isHighlight', { @@ -81,8 +83,8 @@ const DataBlockDetailsForm = ({ s .required('Enter a featured table description') .max( - descriptionMaxLength, - `Featured table description must be ${descriptionMaxLength} characters or less`, + featuredTableDescriptionMaxLength, + `Featured table description must be ${featuredTableDescriptionMaxLength} characters or less`, ), }), isHighlight: Yup.boolean(), @@ -119,7 +121,7 @@ const DataBlockDetailsForm = ({ onBlur={() => { onTitleChange?.(getValues('heading')); }} - maxLength={titleMaxLength} + maxLength={dataBlockTableTitleMaxLength} /> @@ -145,14 +147,14 @@ const DataBlockDetailsForm = ({ label="Featured table name" hint="We will show this name to table builder users as a featured table" className="govuk-!-width-two-thirds" - maxLength={titleMaxLength} + maxLength={featuredTableNameMaxLength} /> name="highlightDescription" label="Featured table description" hint="Describe the contents of this featured table to table builder users" className="govuk-!-width-two-thirds" - maxLength={descriptionMaxLength} + maxLength={featuredTableDescriptionMaxLength} /> }