({
filterOptions,
urlKey,
}: {
filterOptions: AtLeastOne<FilterOption>;
urlKey?: string;
})
| 5 | import { type FilterOption } from "./types"; |
| 6 | |
| 7 | const AddFilterButton = ({ |
| 8 | filterOptions, |
| 9 | urlKey, |
| 10 | }: { |
| 11 | filterOptions: AtLeastOne<FilterOption>; |
| 12 | urlKey?: string; |
| 13 | }) => { |
| 14 | const addFilter = useFilters({ urlKey }).addFilter; |
| 15 | |
| 16 | return ( |
| 17 | <HStack |
| 18 | as={Button} |
| 19 | variant="ghost" |
| 20 | onClick={() => |
| 21 | addFilter({ |
| 22 | id: Date.now().toString(), |
| 23 | field: filterOptions[0].field, |
| 24 | comparator: comparators[0], |
| 25 | value: "", |
| 26 | }) |
| 27 | } |
| 28 | spacing={0} |
| 29 | fontSize="sm" |
| 30 | > |
| 31 | <Icon as={BsPlus} boxSize={5} /> |
| 32 | <Text>Add Filter</Text> |
| 33 | </HStack> |
| 34 | ); |
| 35 | }; |
| 36 | |
| 37 | export default AddFilterButton; |
nothing calls this directly
no test coverage detected