Skip to content

Commit

Permalink
Merge pull request #5487 from dfe-analytical-services/EES-5758
Browse files Browse the repository at this point in the history
EES-5758 Update data block table title limit to 220 chars
  • Loading branch information
mmyoungman authored Dec 31, 2024
2 parents cb0913e + 22338db commit 030b6ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public Validator()
{
RuleFor(request => request.Heading)
.NotEmpty()
.MaximumLength(120);
.MaximumLength(220);

RuleFor(request => request.Name)
.NotEmpty();
Expand Down Expand Up @@ -58,7 +58,7 @@ public Validator()
{
RuleFor(request => request.Heading)
.NotEmpty()
.MaximumLength(120);
.MaximumLength(220);

RuleFor(request => request.Name)
.NotEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ interface FormValues {

export type DataBlockDetailsFormValues = OmitStrict<FormValues, 'isHighlight'>;

const titleMaxLength = 120;
const descriptionMaxLength = 200;
const dataBlockTableTitleMaxLength = 220;
const featuredTableNameMaxLength = 120;
const featuredTableDescriptionMaxLength = 200;

const formId = 'dataBlockDetailsForm';

interface Props {
Expand Down Expand Up @@ -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', {
Expand All @@ -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', {
Expand All @@ -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(),
Expand Down Expand Up @@ -119,7 +121,7 @@ const DataBlockDetailsForm = ({
onBlur={() => {
onTitleChange?.(getValues('heading'));
}}
maxLength={titleMaxLength}
maxLength={dataBlockTableTitleMaxLength}
/>

<FormFieldTextInput<FormValues>
Expand All @@ -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}
/>
<FormFieldTextArea<FormValues>
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}
/>
</>
}
Expand Down

0 comments on commit 030b6ca

Please sign in to comment.