Skip to content

Commit

Permalink
refactor: remove unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Oct 14, 2024
1 parent a032990 commit 221ca35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions editor.planx.uk/src/@planx/components/TextInput/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -37,7 +37,7 @@ export const userDataSchema = ({ type }: TextInput): SchemaOf<UserData> =>
if (type === TextInputType.Email) {
return "Enter an email address in the correct format, like [email protected]";
}
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) {
Expand All @@ -49,7 +49,7 @@ export const userDataSchema = ({ type }: TextInput): SchemaOf<UserData> =>
if (type === TextInputType.Phone) {
return Boolean(value);
}
return Boolean(value && value.length <= TEXT_LIMITS[type].limit);
return Boolean(value && value.length <= TEXT_LIMITS[type]);
},
});

Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/ui/shared/CharacterCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const CharacterCounter: React.FC<Props> = ({

function getLongTextLimit(type: TextInputType): number {
if (isLongTextType(type)) {
return TEXT_LIMITS[type].limit;
return TEXT_LIMITS[type];
} else {
return 0;
}
Expand Down

0 comments on commit 221ca35

Please sign in to comment.