Skip to content

Commit

Permalink
Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
danetsao committed Feb 16, 2024
1 parent d3d01f6 commit cef95d7
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/components/Criteria/CriteriaCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ export default function CriteriaCard({
format: (value) => value ?? CriteriaTerminalType.PASS,
}).input.value;

const noneOfReturnType = (
<FieldArray name={`${name}.criteria`}>
{({ fields }) => fields.map((innerName, index) => (
<CriteriaCard
key={innerName}
name={innerName}
alone={fields.length === 1}
onRemove={() => fields.remove(index)}
/>
))
}
</FieldArray>
);

const cardInterior = useMemo(() => {
switch (type) {
case CriteriaTerminalType.PASS:
Expand All @@ -41,19 +55,7 @@ export default function CriteriaCard({
case CriteriaGroupType.ALL_OF:
case CriteriaGroupType.ANY_OF:
case CriteriaGroupType.NONE_OF:
return (
<FieldArray name={`${name}.criteria`}>
{({ fields }) => fields.map((innerName, index) => (
<CriteriaCard
key={innerName}
name={innerName}
alone={fields.length === 1}
onRemove={() => fields.remove(index)}
/>
))
}
</FieldArray>
);
return (noneOfReturnType);

case CriteriaTerminalType.AGE:
return (
Expand Down Expand Up @@ -101,7 +103,7 @@ export default function CriteriaCard({
default:
return <Loading />;
}
}, [name, type]);
}, [type]);

return (
<Card
Expand Down

0 comments on commit cef95d7

Please sign in to comment.