Skip to content

Commit

Permalink
make the compiler happy
Browse files Browse the repository at this point in the history
  • Loading branch information
joergreichert committed Dec 2, 2023
1 parent 3075e95 commit cbe6ebf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/SearchCheckbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,22 @@ export const SearchCheckbox: FC<SearchCheckboxType> = ({
marketFilterFulltext,
setMarketFilterFulltext
}) => {
const mapping = new Map<string, boolean | undefined>([
["searchInName", marketFilterFulltext?.searchInName],
["searchInDescription", marketFilterFulltext?.searchInDescription],
["searchInStreet", marketFilterFulltext?.searchInStreet],
["searchInDistrict", marketFilterFulltext?.searchInDistrict],
["searchInCity", marketFilterFulltext?.searchInCity],
["searchInOrganizer", marketFilterFulltext?.searchInOrganizer],
]);
const checked = mapping.get(field)
return (
<>
<input type="checkbox" id={`${field}Cb`}
checked={marketFilterFulltext && marketFilterFulltext[field]}
checked={marketFilterFulltext && checked}
onChange={(_) => setMarketFilterFulltext({
...marketFilterFulltext,
[`${field}`]: marketFilterFulltext && !marketFilterFulltext[field]
[`${field}`]: marketFilterFulltext && !checked
})}
/>
<label htmlFor={`${field}Cb`}>{label}</label>
Expand Down

0 comments on commit cbe6ebf

Please sign in to comment.