Skip to content

Commit

Permalink
fix: Give FormWrapper unique id, tighten Option type
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Oct 18, 2023
1 parent 44eebf0 commit 67be834
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions editor.planx.uk/src/@planx/components/Checklist/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function getFlatOptions({
return options;
}
if (groupedOptions) {
return groupedOptions.flatMap((group: any) => group.children);
return groupedOptions.flatMap((group) => group.children);
}
return [];
}
Expand Down Expand Up @@ -142,9 +142,9 @@ const ChecklistComponent: React.FC<Props> = ({
<ErrorWrapper error={formik.errors.checked} id={id}>
<Grid container spacing={layout === ChecklistLayout.Images ? 2 : 0}>
{options ? (
options.map((option: any) =>
options.map((option) =>
layout === ChecklistLayout.Basic ? (
<FormWrapper>
<FormWrapper key={option.id}>
<Grid item xs={12} key={option.data.text}>
<ChecklistItem
onChange={changeCheckbox(option.id)}
Expand Down Expand Up @@ -201,7 +201,7 @@ const ChecklistComponent: React.FC<Props> = ({
isExpanded ? "-expanded" : ""
}`}
>
{group.children.map((option: any) => (
{group.children.map((option) => (
<ChecklistItem
onChange={changeCheckbox(option.id)}
key={option.data.text}
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ export const parseMoreInformation = (
});

export interface Option {
id?: string;
id: string;
data: {
description?: string;
flag?: string;
img?: string;
text?: string;
text: string;
val?: string;
};
}
Expand Down

0 comments on commit 67be834

Please sign in to comment.