All files / components/FilterComponent Filter.tsx

100% Statements 7/7
100% Branches 3/3
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 435x 5x 5x 5x             5x           83x                                                 5x  
import { FilterFilled } from "@ant-design/icons";
import { Button, Flex, Popover, Space } from "antd";
import CheckBoxGroup from "./CheckBoxGroup";
import ExclusiveCheckBoxes from "./ExclusiveCheckBoxes";
interface Props {
  title: string;
  options: { value: string; label: string }[];
  paramName: string;
  allowedMultiple?: boolean;
}
const Filter = ({
  title,
  options,
  paramName,
  allowedMultiple = false,
}: Props) => {
  return (
    <Flex>
      <Popover
        content={
          allowedMultiple ? (
            <CheckBoxGroup options={options} paramName={paramName} />
          ) : (
            <ExclusiveCheckBoxes options={options} paramName={paramName} />
          )
        }
        trigger="click"
        placement="bottomRight"
      >
        <Space.Compact>
          <Button id="TitleButton">{title}</Button>
          <Button id="IconButton">
            <FilterFilled />
          </Button>
        </Space.Compact>
        <div />
      </Popover>
    </Flex>
  );
};
 
export default Filter;