From 221ca3512080238836172b6e072dd2b4f813d779 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Mon, 14 Oct 2024 16:57:50 +0100 Subject: [PATCH] refactor: remove unused variables --- .../src/@planx/components/TextInput/model.ts | 10 +++++----- editor.planx.uk/src/ui/shared/CharacterCounter.tsx | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/TextInput/model.ts b/editor.planx.uk/src/@planx/components/TextInput/model.ts index f0bf508daa..69495dbd06 100644 --- a/editor.planx.uk/src/@planx/components/TextInput/model.ts +++ b/editor.planx.uk/src/@planx/components/TextInput/model.ts @@ -13,9 +13,9 @@ export enum TextInputType { } export const TEXT_LIMITS = { - [TextInputType.Short]: { limit: 120, showCharacterCount: false }, - [TextInputType.Long]: { limit: 250, showCharacterCount: true }, - [TextInputType.ExtraLong]: { limit: 750, showCharacterCount: true }, + [TextInputType.Short]: 120, + [TextInputType.Long]: 250, + [TextInputType.ExtraLong]: 750, } as const; export const emailRegex = @@ -37,7 +37,7 @@ export const userDataSchema = ({ type }: TextInput): SchemaOf => if (type === TextInputType.Email) { return "Enter an email address in the correct format, like name@example.com"; } - return `Your answer must be ${TEXT_LIMITS[type].limit} characters or fewer.`; + return `Your answer must be ${TEXT_LIMITS[type]} characters or fewer.`; })(), test: (value: string | undefined) => { if (!type) { @@ -49,7 +49,7 @@ export const userDataSchema = ({ type }: TextInput): SchemaOf => if (type === TextInputType.Phone) { return Boolean(value); } - return Boolean(value && value.length <= TEXT_LIMITS[type].limit); + return Boolean(value && value.length <= TEXT_LIMITS[type]); }, }); diff --git a/editor.planx.uk/src/ui/shared/CharacterCounter.tsx b/editor.planx.uk/src/ui/shared/CharacterCounter.tsx index 51c1d260aa..22b63312aa 100644 --- a/editor.planx.uk/src/ui/shared/CharacterCounter.tsx +++ b/editor.planx.uk/src/ui/shared/CharacterCounter.tsx @@ -35,7 +35,7 @@ export const CharacterCounter: React.FC = ({ function getLongTextLimit(type: TextInputType): number { if (isLongTextType(type)) { - return TEXT_LIMITS[type].limit; + return TEXT_LIMITS[type]; } else { return 0; }