Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EES-5758 Update data block table title limit to 220 chars #5487

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading