All files / react-app/src/components/SupportPage expandCollapseBtn.tsx

100% Statements 7/7
100% Branches 5/5
100% Functions 2/2
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        77x         13x 4x 2x   2x   2x 2x                                  
import { Minus as MinusIcon, Plus as PlusIcon } from "lucide-react";
 
import { Button } from "@/components";
 
const ExpandCollapseButton = (props: {
  expandAll: () => void;
  collapseAll: () => void;
  areAllOpen: boolean;
}) => {
  const callBack = () => {
    if (props.areAllOpen) {
      props.collapseAll();
 
      return;
    }
    props.expandAll();
    return;
  };
 
  return (
    <Button
      onClick={callBack}
      variant="link"
      data-testid="expand-all"
      className="w-full xs:w-fit hover:bg-transparent"
    >
      <span>{props.areAllOpen ? "Collapse all" : "Expand all"}</span>
      {props.areAllOpen ? <MinusIcon /> : <PlusIcon />}
    </Button>
  );
};
 
export default ExpandCollapseButton;